public class HotSwappingInvoker<T> extends DelegatingInvoker<java.lang.Object>
DelegatingInvoker implementation that allows the exchange of the delegate.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
HotSwappingInvoker.CycleCheck
Internal interface used to detect cyclic swapping activity.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.reflect.Method |
checkForCycle |
private java.lang.ThreadLocal<java.lang.Object> |
delegate |
private boolean |
executed |
private static java.lang.reflect.Method |
hotswap |
private static long |
serialVersionUID |
private java.lang.Class<?>[] |
types |
| Constructor and Description |
|---|
HotSwappingInvoker(java.lang.Class<?>[] types,
ProxyFactory proxyFactory,
ObjectReference<java.lang.Object> delegateReference,
DelegationMode delegationMode)
Construct a HotSwappingInvoker.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
delegate()
Retrieve the delegated object in derived classes.
|
protected java.lang.Object |
hotswap(java.lang.Object newDelegate)
Exchange the current delegate.
|
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.
|
T |
proxy()
Create a proxy for this Invoker.
|
private void |
readObject(java.io.ObjectInputStream in) |
private void |
writeObject(java.io.ObjectOutputStream out) |
equals, getDelegateReference, getMethodToInvoke, getProxyFactory, hashCode, invokeOnDelegateprivate static final long serialVersionUID
private static final java.lang.reflect.Method hotswap
private static final java.lang.reflect.Method checkForCycle
private java.lang.Class<?>[] types
private transient boolean executed
private transient java.lang.ThreadLocal<java.lang.Object> delegate
public HotSwappingInvoker(java.lang.Class<?>[] types,
ProxyFactory proxyFactory,
ObjectReference<java.lang.Object> delegateReference,
DelegationMode delegationMode)
types - the types of the proxyproxyFactory - the ProxyFactory to usedelegateReference - the ObjectReference with the delegatedelegationMode - DelegationMode.DIRECT or DelegationMode.SIGNATUREpublic java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
Invokerinvoke in interface Invokerinvoke in class DelegatingInvoker<java.lang.Object>proxy - the proxy instance.method - the method to invoke.args - the arguments of the method.java.lang.Throwable - if the invoked method has thrown.protected java.lang.Object delegate()
DelegatingInvokerdelegate in class DelegatingInvoker<java.lang.Object>protected java.lang.Object hotswap(java.lang.Object newDelegate)
newDelegate - the new delegatejava.lang.IllegalStateException - if cyclic swapping action is detectedpublic T proxy()
Swappable interface.private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException
java.io.IOExceptionprivate void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException