|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.proxy.DelegatingProxyFactory<T>
org.javasimon.callback.async.ExecutorProxyFactory<Callback>
org.javasimon.callback.async.AsyncCallbackProxyFactory
public final class AsyncCallbackProxyFactory
Callback factory, produces a callback wrapper to make any callback asynchronous.
Example: 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());
| Field Summary | |
|---|---|
private Method |
getDelegateMethod
|
private static Class[] |
PROXY_INTERFACES
Interfaces implemented by callback proxy |
| Constructor Summary | |
|---|---|
AsyncCallbackProxyFactory(Callback delegate)
Constructor |
|
AsyncCallbackProxyFactory(Callback delegate,
Executor executor)
Constructor |
|
| Method Summary | |
|---|---|
private Method |
findGetDelegateMethod()
Find Delegating.getDelegate() method |
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. |
| Methods inherited from class org.javasimon.callback.async.ExecutorProxyFactory |
|---|
getExecutor, setExecutor |
| Methods inherited from class org.javasimon.proxy.DelegatingProxyFactory |
|---|
getDelegate, invoke, newProxy, newProxy, newProxy |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final Class[] PROXY_INTERFACES
private final Method getDelegateMethod
| Constructor Detail |
|---|
public AsyncCallbackProxyFactory(Callback delegate)
delegate - Wrapped object
public AsyncCallbackProxyFactory(Callback delegate,
Executor executor)
delegate - Wrapped objectexecutor - Executor used to run callback method, see Executors| Method Detail |
|---|
private Method findGetDelegateMethod()
Delegating.getDelegate() method
public Callback newProxy(ClassLoader classLoader)
classLoader - Class loader
public Callback newProxy()
classLoader - Class loader
protected Object invoke(DelegatingMethodInvocation<Callback> delegatingMethodInvocation)
throws Throwable
DelegatingProxyFactory
invoke in class ExecutorProxyFactory<Callback>delegatingMethodInvocation - Method invocation (arguments, method name, etc.)
Throwable - Method invocation raised exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||