Class NeovimHandlerProxy
java.lang.Object
com.ensarsarajcic.neovim.java.handler.NeovimHandlerProxy
- All Implemented Interfaces:
RpcListener.NotificationCallback
,RpcListener.RequestCallback
public final class NeovimHandlerProxy
extends Object
implements RpcListener.RequestCallback, RpcListener.NotificationCallback
Class acting as both a container of
RpcListener.RequestCallback
and RpcListener.NotificationCallback
and as a listener
It passes all notifications/requests to contained listeners through a ExecutorService
By default ImmediateExecutorService
is used
Default instance with ImmediateExecutorService
is used by default in NeovimHandlerManager
This allows handlers to not block used streamer when notifications/requests arrive and when many handlers are used
Example:
NeovimHandlerProxy neovimHandlerProxy = new NeovimHandlerProxy(customExecutorService);
NeovimHandlerManager neovimHandlerManager = new NeovimHandlerManager(neovimHandlerProxy);
neovimHandlerManager.registerNeovimHandler(uiEventHandler);
neovimHandlerManager.attachToStream(neovimStream); // All notifications/requests are passed down using customExecutorService now
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNotificationCallback
(String notificationName, RpcListener.NotificationCallback notificationCallback) void
addNotificationCallbacks
(String notificationName, List<RpcListener.NotificationCallback> notificationCallback) void
addRequestCallback
(String requestName, RpcListener.RequestCallback requestCallback) void
addRequestCallbacks
(String requestName, List<RpcListener.RequestCallback> requestCallback) void
notificationReceived
(NotificationMessage notificationMessage) void
removeNotificationCallback
(String notificationName, RpcListener.NotificationCallback notificationCallback) void
removeNotificationCallbacks
(String notificationName, List<RpcListener.NotificationCallback> notificationCallback) void
removeRequestCallback
(String requestName, RpcListener.RequestCallback requestCallback) void
removeRequestCallbacks
(String requestName, List<RpcListener.RequestCallback> requestCallback) void
requestReceived
(RequestMessage requestMessage) void
setFallbackHandler
(RpcListener.RequestCallback fallbackHandler)
-
Constructor Details
-
NeovimHandlerProxy
public NeovimHandlerProxy() -
NeovimHandlerProxy
-
-
Method Details
-
addNotificationCallback
public void addNotificationCallback(String notificationName, RpcListener.NotificationCallback notificationCallback) -
addNotificationCallbacks
public void addNotificationCallbacks(String notificationName, List<RpcListener.NotificationCallback> notificationCallback) -
addRequestCallback
-
addRequestCallbacks
public void addRequestCallbacks(String requestName, List<RpcListener.RequestCallback> requestCallback) -
setFallbackHandler
-
removeNotificationCallback
public void removeNotificationCallback(String notificationName, RpcListener.NotificationCallback notificationCallback) -
removeNotificationCallbacks
public void removeNotificationCallbacks(String notificationName, List<RpcListener.NotificationCallback> notificationCallback) -
removeRequestCallback
-
removeRequestCallbacks
public void removeRequestCallbacks(String requestName, List<RpcListener.RequestCallback> requestCallback) -
notificationReceived
- Specified by:
notificationReceived
in interfaceRpcListener.NotificationCallback
-
requestReceived
- Specified by:
requestReceived
in interfaceRpcListener.RequestCallback
-