Package sk.ipesoft.d2000.async
Interface FutureEvent<V>
-
- Type Parameters:
V
- result type of future
- All Superinterfaces:
java.util.concurrent.Future<V>
- All Known Implementing Classes:
AdjustableFuture
,FutureEventWrapper
public interface FutureEvent<V> extends java.util.concurrent.Future<V>
Standard Future with ability to notify listeners when future computation is done
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEventHandler(FutureEventHandler<V> futureEventHandler)
Add handler for handling result of the future.void
addEventHandler(FutureEventHandler<V> futureEventHandler, java.util.concurrent.Executor executor)
Add handler for handling result of the future and executor with thread for execution of handling.
-
-
-
Method Detail
-
addEventHandler
void addEventHandler(FutureEventHandler<V> futureEventHandler)
Add handler for handling result of the future.In case that result of the future has been available prior this call, the
futureEventHandler
will be invoked immediately on calling thread. Otherwise it will be invoked when result of the future is available on thread that provided result of the future.Warning: handling of the result should be quick, because it can slow-down the system. Use
addEventHandler(FutureEventHandler, Executor)
for adding long-running handlers.- Parameters:
futureEventHandler
- handler of future result
-
addEventHandler
void addEventHandler(FutureEventHandler<V> futureEventHandler, java.util.concurrent.Executor executor)
Add handler for handling result of the future and executor with thread for execution of handling.In case that result of the future has been available prior this call, the
futureEventHandler
will be passed to executor immediately. Otherwise it will be passed when result of the future is available.- Parameters:
futureEventHandler
- handler of future resultexecutor
- encapsulation of thread that will execute result's handling
-
-