Class SharedBlockingCallback.Blocker

java.lang.Object
org.eclipse.jetty.util.SharedBlockingCallback.Blocker
All Implemented Interfaces:
Closeable, AutoCloseable, Runnable, Callback, Invocable
Enclosing class:
SharedBlockingCallback

public class SharedBlockingCallback.Blocker extends Object implements Callback, Closeable, Runnable
A Closeable Callback. Uses the auto close mechanism to check block has been called OK.

Implements Callback because calls to this callback do not blocak, rather they wakeup the thread that is blocked in block()

  • Constructor Details

    • Blocker

      protected Blocker()
  • Method Details

    • getInvocationType

      public Invocable.InvocationType getInvocationType()
      Specified by:
      getInvocationType in interface Invocable
      Returns:
      The InvocationType of this object
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • succeeded

      public void succeeded()
      Description copied from interface: Callback

      Callback invoked when the operation completes.

      Specified by:
      succeeded in interface Callback
      See Also:
    • failed

      public void failed(Throwable cause)
      Description copied from interface: Callback

      Callback invoked when the operation fails.

      Specified by:
      failed in interface Callback
      Parameters:
      cause - the reason for the operation failure
    • block

      public void block() throws IOException
      Block until the Callback has succeeded or failed and after the return leave in the state to allow reuse. This is useful for code that wants to repeatable use a FutureCallback to convert an asynchronous API to a blocking API.
      Throws:
      IOException - if exception was caught during blocking, or callback was cancelled
    • close

      public void close()
      Check the Callback has succeeded or failed and after the return leave in the state to allow reuse.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • toString

      public String toString()
      Overrides:
      toString in class Object