Package com.palantir.common.proxy
Class InterruptibleProxy
- java.lang.Object
-
- com.palantir.common.proxy.InterruptibleProxy
-
- All Implemented Interfaces:
DelegatingInvocationHandler
,InvocationHandler
public final class InterruptibleProxy extends Object implements DelegatingInvocationHandler
Proxy that calls the requested method in another thread waits on a Future. If the calling thread is interrupted, this proxy will throw a PalantirInterruptedException. If given the CancelDelgate#Cancel option, it will also interrupt the delegated thread.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getDelegate()
Object
invoke(Object proxy, Method method, Object[] args)
static <T> T
newProxyInstance(Class<T> interfaceClass, T delegate, CancelDelegate cancel)
static <T> T
newProxyInstance(Class<T> interfaceClass, T delegate, CancelDelegate cancel, ExecutorService executor)
-
-
-
Method Detail
-
newProxyInstance
public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, CancelDelegate cancel)
-
newProxyInstance
public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, CancelDelegate cancel, ExecutorService executor)
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
getDelegate
public Object getDelegate()
- Specified by:
getDelegate
in interfaceDelegatingInvocationHandler
-
-