public class NioChannelDelegateInvocationHandler extends AutoCloseableDelegateInvocationHandler
Channel delegate into a proxy instance that closes both when wrapper
close method called. The Channel.isOpen() call is invoked only on the delegate| Constructor and Description |
|---|
NioChannelDelegateInvocationHandler(java.lang.Object proxyTarget,
java.nio.channels.Channel delegate) |
| Modifier and Type | Method and Description |
|---|---|
java.nio.channels.Channel |
getChannelDelegate() |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args) |
static boolean |
isQueryOpenMethodInvocation(java.lang.reflect.Method m) |
static boolean |
isQueryOpenMethodInvocation(java.lang.reflect.Method m,
java.lang.Object[] args) |
static <T extends java.nio.channels.Channel> |
wrapDelegateChannel(java.lang.Object proxyTarget,
java.lang.Class<T> type,
java.nio.channels.Channel delegate)
Wraps a target instance and a
Channel delegate into a proxy instance that closes both when wrapper
close method called. |
getAutoCloseableDelegate, getProxyTarget, isCloseMethod, isCloseMethodInvocation, wrapDelegateCloseablepublic NioChannelDelegateInvocationHandler(java.lang.Object proxyTarget,
java.nio.channels.Channel delegate)
public java.nio.channels.Channel getChannelDelegate()
public java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
invoke in interface java.lang.reflect.InvocationHandlerinvoke in class AutoCloseableDelegateInvocationHandlerjava.lang.Throwablepublic static <T extends java.nio.channels.Channel> T wrapDelegateChannel(java.lang.Object proxyTarget,
java.lang.Class<T> type,
java.nio.channels.Channel delegate)
Channel delegate into a proxy instance that closes both when wrapper
close method called. The Channel.isOpen() call is invoked only on the delegateT - The generic Channel wrapping interfaceproxyTarget - The (never null) target instance - if not AutoCloseable then it's
close() method will not be invoked (i.e., only the delegate)type - The target wrapping interfacedelegate - The (never null) delegate to use. Note: the delegate is closed after
the target instance.public static boolean isQueryOpenMethodInvocation(java.lang.reflect.Method m,
java.lang.Object[] args)
public static boolean isQueryOpenMethodInvocation(java.lang.reflect.Method m)