public abstract class CompletableCallback extends Object implements Callback
resume() or abort(Throwable) will be called to allow the
application to resume the processing.
Typical usage:
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
Callback.Adapter| Constructor and Description |
|---|
CompletableCallback() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
abort(Throwable failure)
Callback method invoked when this callback is failed
after a first call to
tryComplete(). |
void |
failed(Throwable x)
Callback invoked when the operation fails.
|
abstract void |
resume()
Callback method invoked when this callback is succeeded
after a first call to
tryComplete(). |
void |
succeeded()
Callback invoked when the operation completes.
|
boolean |
tryComplete()
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.
|
public void succeeded()
CallbackCallback invoked when the operation completes.
succeeded in interface CallbackCallback.failed(Throwable)public void failed(Throwable x)
CallbackCallback invoked when the operation fails.
public abstract void resume()
tryComplete().public abstract void abort(Throwable failure)
tryComplete().public boolean tryComplete()
Copyright © 1995-2015 Webtide. All Rights Reserved.