Class AsyncEventDispatcher

java.lang.Object
com.couchbase.client.dcp.highlevel.internal.AsyncEventDispatcher
All Implemented Interfaces:
EventDispatcher

public class AsyncEventDispatcher extends Object implements EventDispatcher
Dispatches events in a separate dedicated thread.
  • Constructor Details

  • Method Details

    • dispatch

      public void dispatch(DatabaseChangeEvent event)
      Specified by:
      dispatch in interface EventDispatcher
    • 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 interface EventDispatcher
    • 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 interface EventDispatcher
    • awaitTermination

      public boolean awaitTermination(Duration timeout) throws InterruptedException
      Blocks until the dispatch thread terminates or the timeout expires.
      Specified by:
      awaitTermination in interface EventDispatcher
      Returns:
      true if the thread terminated within the timeout period
      Throws:
      InterruptedException