public class FutureInvoker extends java.lang.Object implements Invoker
Invoker that implements transparent asynchronous
method calls. The invoked method will return immediately with a result that can be
hot swapped. This result proxy contains first a null object and will automatically replaced later on when the asynchronous method call
returns the correct result.| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ExecutorService |
executor |
private ProxyFactory |
proxyFactory |
private static long |
serialVersionUID |
private java.lang.Object |
target |
| Constructor and Description |
|---|
FutureInvoker(java.lang.Object target,
ProxyFactory proxyFactory,
java.util.concurrent.ExecutorService executor)
Construct the invoker.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Invocation of a method of the proxied object.
|
private static final long serialVersionUID
private final java.lang.Object target
private final ProxyFactory proxyFactory
private final java.util.concurrent.ExecutorService executor
public FutureInvoker(java.lang.Object target,
ProxyFactory proxyFactory,
java.util.concurrent.ExecutorService executor)
target - the instance that will have its methods called asynchronouslyproxyFactory - the proxy factory used to create the proxy for the target instance
and all return types of the called methodsexecutor - the executor used to call the method asynchronouslypublic java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
Invoker