|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.asyncobjects.util.AsyncProcess<R>
R - a result typepublic abstract class AsyncProcess<R>
This utility class represents a simple asynchronous operation. It is mostly used to implement asynchronous loops. It exists to compensate problems with tail recursion implementation.
| Nested Class Summary | |
|---|---|
protected class |
AsyncProcess.ProcessWhen<I>
A utility when variant that fails process (using failure(Throwable)) if promise is smashed or body
is smashed. |
| Constructor Summary | |
|---|---|
protected |
AsyncProcess()
A construct for processs |
| Method Summary | |
|---|---|
protected void |
failure(Throwable problem)
Subclasses should call this method to indicate that process failed. |
protected void |
onFailure(Throwable problem)
This method is called when process completed unsuccessfully. |
protected void |
onSuccess(R value)
This method is called when process completed successfully. |
Promise<R> |
promise()
|
protected abstract void |
run()
Process body. |
protected void |
success(Promise<R> value)
Subclasses should call this method to indicate that process finished successfully. |
protected void |
success(R value)
Subclasses should call this method to indicate that process finished successfully. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AsyncProcess()
| Method Detail |
|---|
protected abstract void run()
throws Throwable
Throwable - in case of any problemprotected final void success(R value)
value - a value of the processprotected final void success(Promise<R> value)
value - a value of the processprotected final void failure(Throwable problem)
problem - a problem associated with processpublic final Promise<R> promise()
protected void onFailure(Throwable problem)
problem - a problem of the processprotected void onSuccess(R value)
value - a value of the process
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||