Package org.eclipse.jetty.util
Class SharedBlockingCallback.Blocker
- java.lang.Object
-
- org.eclipse.jetty.util.SharedBlockingCallback.Blocker
-
- Enclosing class:
- SharedBlockingCallback
public class SharedBlockingCallback.Blocker extends java.lang.Object implements Callback, java.io.Closeable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType
-
-
Field Summary
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Blocker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
block()
Block until the Callback has succeeded or failed and after the return leave in the state to allow reuse.void
close()
Check the Callback has succeeded or failed and after the return leave in the state to allow reuse.void
failed(java.lang.Throwable cause)
Callback invoked when the operation fails.Invocable.InvocationType
getInvocationType()
void
succeeded()
Callback invoked when the operation completes.java.lang.String
toString()
-
-
-
Method Detail
-
getInvocationType
public Invocable.InvocationType getInvocationType()
- Specified by:
getInvocationType
in interfaceInvocable
- Returns:
- The InvocationType of this object
-
succeeded
public void succeeded()
Description copied from interface:Callback
Callback invoked when the operation completes.
- Specified by:
succeeded
in interfaceCallback
- See Also:
Callback.failed(Throwable)
-
failed
public void failed(java.lang.Throwable cause)
Description copied from interface:Callback
Callback invoked when the operation fails.
-
block
public void block() throws java.io.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:
java.io.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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-