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 TypeMethodDescriptionbooleanawaitTermination(Duration timeout) Blocks until the dispatch thread terminates or the timeout expires.voiddispatch(DatabaseChangeEvent event) voidAllows the listener to finish processing the current event and then starts terminating the dispatch thread.voidInterrupts the listener and starts terminating the dispatch thread.
-
Constructor Details
-
AsyncEventDispatcher
-
-
Method Details
-
dispatch
- Specified by:
dispatchin 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:
shutdownNowin 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:
gracefulShutdownin interfaceEventDispatcher
-
awaitTermination
Blocks until the dispatch thread terminates or the timeout expires.- Specified by:
awaitTerminationin interfaceEventDispatcher- Returns:
- true if the thread terminated within the timeout period
- Throws:
InterruptedException
-