Class WaitConditionShutdownListener

java.lang.Object
org.keycloak.connections.infinispan.shutdown.WaitConditionShutdownListener
All Implemented Interfaces:
ShutdownListener

public class WaitConditionShutdownListener extends Object implements ShutdownListener
A ShutdownListener that blocks the shutdown thread until a ShutdownCondition is no longer in progress, or until the provided deadline elapses.

External events should invoke check() whenever the condition may have changed (e.g. after a topology change event). If the condition has cleared, the waiting shutdown thread is unblocked and ShutdownCondition.complete() is called. If the timeout expires first, ShutdownCondition.onTimeout() is called instead.

  • Constructor Details

    • WaitConditionShutdownListener

      public WaitConditionShutdownListener(ShutdownCondition condition)
  • Method Details

    • onShutdown

      public void onShutdown(Instant shutdownTime, Date deadline)
      Description copied from interface: ShutdownListener
      Called when the server shutdown is initiated.
      Specified by:
      onShutdown in interface ShutdownListener
      Parameters:
      shutdownTime - The instant at which the shutdown was initiated.
      deadline - The absolute deadline by which this listener must return.
    • check

      public void check()
      Checks whether the ShutdownCondition is still in progress and, if not, signals the waiting shutdown thread to proceed.

      This method should be called from external event handlers (e.g. topology change listeners) whenever the condition may have changed.