Package org.eclipse.jetty.util
Class CompletableCallback
- java.lang.Object
-
- org.eclipse.jetty.util.CompletableCallback
-
@Deprecated public abstract class CompletableCallback extends java.lang.Object implements Callback
Deprecated.not used anymoreA callback to be used by driver code that needs to know whether the callback has been succeeded or failed (that is, completed) just after the asynchronous operation or not, typically because further processing depends on the callback being completed. The driver code competes with the asynchronous operation to complete the callback.
If the callback is already completed, the driver code continues the processing, otherwise it suspends it. If it is suspended, the callback will be completed some time later, and
Typical usage:resume()
orabort(Throwable)
will be called to allow the application to resume the processing.CompletableCallback callback = new CompletableCallback() { @Override public void resume() { // continue processing } @Override public void abort(Throwable failure) { // abort processing } } asyncOperation(callback); boolean completed = callback.tryComplete(); if (completed) // suspend processing, async operation not done yet else // continue processing, async operation already done
-
-
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 Constructor Description CompletableCallback()
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract void
abort(java.lang.Throwable failure)
Deprecated.Callback method invoked when this callback is failed.void
failed(java.lang.Throwable x)
Deprecated.Callback invoked when the operation fails.abstract void
resume()
Deprecated.Callback method invoked when this callback is succeeded after a first call totryComplete()
.void
succeeded()
Deprecated.Callback invoked when the operation completes.boolean
tryComplete()
Deprecated.Tries to complete this callback; driver code should call this method once after the asynchronous operation to detect whether the asynchronous operation has already completed or not.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
-
-
-
-
Method Detail
-
succeeded
public void succeeded()
Deprecated.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 x)
Deprecated.Description copied from interface:Callback
Callback invoked when the operation fails.
-
resume
public abstract void resume()
Deprecated.Callback method invoked when this callback is succeeded after a first call totryComplete()
.
-
abort
public abstract void abort(java.lang.Throwable failure)
Deprecated.Callback method invoked when this callback is failed.- Parameters:
failure
- the throwable reprsenting the callback failure
-
tryComplete
public boolean tryComplete()
Deprecated.Tries to complete this callback; driver code should call this method once after the asynchronous operation to detect whether the asynchronous operation has already completed or not.- Returns:
- whether the attempt to complete was successful.
-
-