Interface IAsyncHandler

All Known Implementing Classes:
AbstractAsyncHandlerProvider.ClosedProviderAsyncHandler, ThreadAsyncHandlerProvider.AsyncRunnableWrapper

public interface IAsyncHandler
Wraps a repetitive executing runnable which is provided to a IAsyncHandlerProvider.start(IAsyncCallable, long, String, boolean) invocation and controls its life cycle.
Since:
8.0
Author:
eitany
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    Specifies whether this async handler is terminated and will not run again
    void
    Resume the life cycle of the handler if it is in suspended mode, the next execution will be scheduled according to the idle delay timeout the handler was created with
    void
    Resume the life cycle of the handler if it is in suspended mode, the next execution will start immediately.
    void
    stop(long timeout, TimeUnit units)
    Stop the execution of this async handler.
    void
    Wakes up the handler if in idle state and execute a cycle of the runnable
    boolean
    wakeUpAndWait(long timeout, TimeUnit units)
    Wakes up the handler if in idle or suspended state and wait for it complete one cycle.
  • Method Details

    • wakeUp

      void wakeUp()
      Wakes up the handler if in idle state and execute a cycle of the runnable
    • wakeUpAndWait

      boolean wakeUpAndWait(long timeout, TimeUnit units)
      Wakes up the handler if in idle or suspended state and wait for it complete one cycle. Will wait for the specified timeout until one cycle is completed and returns true if the cycle was completed during that timeout, otherwise false.
    • stop

      void stop(long timeout, TimeUnit units)
      Stop the execution of this async handler. Will wait for the specified timeout until the handler is stopped which guarantees no following execution of the wrapped runnable. If the timeout elapsed this method returns but there might be an ongoing execution which was not stopped yet. However that will be no new execution after this method returns
    • resume

      void resume()
      Resume the life cycle of the handler if it is in suspended mode, the next execution will be scheduled according to the idle delay timeout the handler was created with
      Since:
      8.0.5
    • resumeNow

      void resumeNow()
      Resume the life cycle of the handler if it is in suspended mode, the next execution will start immediately.
      Since:
      8.0.5
    • isTerminated

      boolean isTerminated()
      Specifies whether this async handler is terminated and will not run again
    • getName

      String getName()