|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

public interface IFutureWithListeners<RESULT>
| Method Summary | |
|---|---|
void |
addFutureListener(IFutureListener<RESULT> listener)
Adds a listener on a future status (using strong reference). |
boolean |
cancel(boolean mayInterruptIfRunning)
|
void |
computationException(Exception e)
Informs the future that it can't be computed due to the exception. |
RESULT |
get()
|
RESULT |
get(long timeout,
TimeUnit unit)
Returns a result or waits for the computation till timeout. |
Exception |
getException()
Contains an exception that has happened during the computation in the case of ( FutureWithListeners.getStatus() == EXCEPTION). |
FutureStatus |
getStatus()
Current status of the future computation. |
boolean |
isCancelled()
|
boolean |
isDone()
|
boolean |
isListening(IFutureListener<RESULT> listener)
Whether some listener is listening on the future. |
void |
removeFutureListener(IFutureListener<RESULT> listener)
Removes a listener from the future. |
void |
setResult(RESULT result)
Sets the result of the future computation. |
| Method Detail |
|---|
void addFutureListener(IFutureListener<RESULT> listener)
listener - boolean cancel(boolean mayInterruptIfRunning)
cancel in interface Future<RESULT>void computationException(Exception e)
Switches the status to EXCEPTION (notifying listeners along the way).
The result can be set only iff NOT FutureWithListeners.isDone(), i.e., status is FutureStatus:FUTURE_IS_BEING_COMPUTED.
e - RESULT get()
get in interface Future<RESULT>
RESULT get(long timeout,
TimeUnit unit)
Does not throw TimeoutException! It returns null instead - always examine status of the future
via FutureWithListeners.getStatus() if the null is returned to tell whether the 'null' is the
result of the computation (if the status is FUTURE_IS_READY than the 'null' is truly the result).
get in interface Future<RESULT>timeout - unit -
Exception getException()
FutureWithListeners.getStatus() == EXCEPTION).
FutureStatus getStatus()
boolean isCancelled()
isCancelled in interface Future<RESULT>boolean isDone()
isDone in interface Future<RESULT>boolean isListening(IFutureListener<RESULT> listener)
listener -
void removeFutureListener(IFutureListener<RESULT> listener)
listener - void setResult(RESULT result)
Switches the status to FUTURE_IS_READY (notifying listeners along the way).
The result can be set only iff NOT FutureWithListeners.isDone(), i.e., status is FutureStatus:FUTURE_IS_BEING_COMPUTED.
result -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||