Class AsyncEventDispatcher
java.lang.Object
com.couchbase.client.dcp.highlevel.internal.AsyncEventDispatcher
- All Implemented Interfaces:
EventDispatcher
Dispatches events in a separate dedicated thread.
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncEventDispatcher
(FlowControlMode flowControlMode, DatabaseChangeListener consumer) -
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitTermination
(Duration timeout) Blocks until the dispatch thread terminates or the timeout expires.void
dispatch
(DatabaseChangeEvent event) void
Allows the listener to finish processing the current event and then starts terminating the dispatch thread.void
Interrupts the listener and starts terminating the dispatch thread.
-
Constructor Details
-
AsyncEventDispatcher
-
-
Method Details
-
dispatch
- Specified by:
dispatch
in interfaceEventDispatcher
-
shutdownNow
public void shutdownNow()Interrupts the listener and starts terminating the dispatch thread. NOTE: Any events remaining in the queue will not be dispatched and will not be flow control ACK'd. Consequently, this method should only be called as part of the DCP channel shutdown process.- Specified by:
shutdownNow
in interfaceEventDispatcher
-
gracefulShutdown
public void gracefulShutdown()Allows the listener to finish processing the current event and then starts terminating the dispatch thread. NOTE: Any events remaining in the queue will not be dispatched and will not be flow control ACK'd. Consequently, this method should only be called as part of the DCP channel shutdown process.- Specified by:
gracefulShutdown
in interfaceEventDispatcher
-
awaitTermination
Blocks until the dispatch thread terminates or the timeout expires.- Specified by:
awaitTermination
in interfaceEventDispatcher
- Returns:
- true if the thread terminated within the timeout period
- Throws:
InterruptedException
-