/** * Explicitly passes the given ThreadConfinedProxy to a new thread. If the proxy passed in is not a ThreadConfinedProxy, but is a * different type of proxy that also uses a {@linkplain DelegatingInvocationHandler}, this method will recursively apply to the * delegate. This means that this method can handle arbitrarily nested DelegatingInvocationHandlers, including nested * ThreadConfinedProxy objects. * */ public static void changeThread(Object proxy, Thread oldThread, Thread newThread) { Validate.notNull(proxy, "Proxy argument must not be null"); if (Proxy.isProxyClass(proxy.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(proxy); changeHandlerThread(handler, oldThread, newThread); } else if (proxy instanceof Delegator) { changeThread(((Delegator) proxy).getDelegate(), oldThread, newThread); } }
/** * Explicitly passes the given ThreadConfinedProxy to a new thread. If the proxy passed in is not a ThreadConfinedProxy, but is a * different type of proxy that also uses a {@linkplain DelegatingInvocationHandler}, this method will recursively apply to the * delegate. This means that this method can handle arbitrarily nested DelegatingInvocationHandlers, including nested * ThreadConfinedProxy objects. * */ public static void changeThread(Object proxy, Thread oldThread, Thread newThread) { Validate.notNull(proxy, "Proxy argument must not be null"); if (Proxy.isProxyClass(proxy.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(proxy); changeHandlerThread(handler, oldThread, newThread); } else if (proxy instanceof Delegator) { changeThread(((Delegator) proxy).getDelegate(), oldThread, newThread); } }