Promise.OnCancelListener, Promise.OnCompleteListener<RESULT>, Promise.OnFailListener| Modifier and Type | Field and Description |
|---|---|
protected static TaggedLogger |
LOG |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPromise()
Default constructor.
|
protected |
AbstractPromise(java.util.concurrent.Executor executor)
Alternate constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
abort()
Called when a cancel request is received and before the
OnCancelListener#onCancelled() is called. |
void |
cancel()
Final method.
|
boolean |
isCancelled()
|
boolean |
isDone()
See
Promise.isDone() |
boolean |
isFailed()
|
AbstractPromise<RESULT> |
onCancel(Promise.OnCancelListener listener)
|
AbstractPromise<RESULT> |
onComplete(Promise.OnCompleteListener<RESULT> listener)
|
AbstractPromise<RESULT> |
onFail(Promise.OnFailListener listener)
|
protected abstract RESULT |
result()
Obtain the result for this task.
|
void |
run()
Final method.
|
boolean |
succeeded()
|
protected AbstractPromise()
protected AbstractPromise(java.util.concurrent.Executor executor)
Executor. For UI use, pass in ThreadPool.foreground() and save yourself the trouble of View.post(Runnable) or Activity.runOnUIThread(Runnable)executor - executor to execute callbacks on.public final void run()
run in interface java.lang.Runnablepublic final void cancel()
protected abstract RESULT result() throws java.lang.Exception
java.lang.Exceptionprotected void abort()
OnCancelListener#onCancelled() is called. If you
are able to abort the execution, this is where you do it. Does nothing by default.public AbstractPromise<RESULT> onComplete(Promise.OnCompleteListener<RESULT> listener)
onComplete in interface Promise<RESULT>listener - listener to notify on completionpublic AbstractPromise<RESULT> onFail(Promise.OnFailListener listener)
public AbstractPromise<RESULT> onCancel(Promise.OnCancelListener listener)
public boolean isDone()
Promise.isDone()public boolean succeeded()
public boolean isFailed()
public boolean isCancelled()
isCancelled in interface Promise<RESULT>true if task has been cancelled, false otherwise