public final class AsyncCallbackProxyFactory extends ExecutorProxyFactory<Callback>
Callback myAsyncCallback=new AsyncCallbackProxy(myCallback).newProxy();
The purpose of this wrapping callback is to prevent the wrapped callback
from being executed on the main thread. This can be useful when a concrete
callback is time consuming, to reduce the impact on application performances.
It can be used to disable/enable, at runtime, a callback without removing it from
the SimonManager: asyncCallbackProxy.setExecutor(Executors.disabled);| Constructor and Description |
|---|
AsyncCallbackProxyFactory(Callback delegate)
Constructor.
|
AsyncCallbackProxyFactory(Callback delegate,
Executor executor)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
invoke(DelegatingMethodInvocation<Callback> delegatingMethodInvocation)
Method to override in child classes.
|
Callback |
newProxy()
Creates a callback proxy.
|
Callback |
newProxy(ClassLoader classLoader)
Creates a callback proxy.
|
getExecutor, setExecutorgetDelegate, invoke, newProxy, newProxy, newProxypublic AsyncCallbackProxyFactory(Callback delegate)
delegate - Wrapped objectpublic AsyncCallbackProxyFactory(Callback delegate, Executor executor)
delegate - Wrapped objectexecutor - Executor used to run callback method, see Executorspublic Callback newProxy(ClassLoader classLoader)
classLoader - Class loaderpublic Callback newProxy()
protected Object invoke(DelegatingMethodInvocation<Callback> delegatingMethodInvocation) throws Throwable
DelegatingProxyFactoryinvoke in class ExecutorProxyFactory<Callback>delegatingMethodInvocation - Method invocation (arguments, method name, etc.)Throwable - Method invocation raised exceptionCopyright © 2019. All rights reserved.