Class CloseShieldChannelHandler

java.lang.Object
org.apache.commons.io.channels.CloseShieldChannelHandler
All Implemented Interfaces:
InvocationHandler

final class CloseShieldChannelHandler extends Object implements InvocationHandler
An InvocationHandler supporting the implementation of CloseShieldChannel.
  • Field Details

    • SUPPORTED_INTERFACES

      private static final Set<Class<? extends Channel>> SUPPORTED_INTERFACES
    • delegate

      private final Channel delegate
    • closed

      private volatile boolean closed
  • Constructor Details

    • CloseShieldChannelHandler

      CloseShieldChannelHandler(Channel delegate)
  • Method Details

    • isAllowedAfterClose

      private static boolean isAllowedAfterClose(Class<?> declaringClass, String name, int parameterCount)
      Tests whether the given method is allowed to be called after the shield is closed.
      Parameters:
      declaringClass - The class declaring the method.
      name - The method name.
      parameterCount - The number of parameters.
      Returns:
      true if the method is allowed after close(), false otherwise.
    • isSupported

      static boolean isSupported(Class<?> interfaceClass)
    • returnsThis

      private static boolean returnsThis(Class<?> declaringClass, String name, int parameterCount)
      Tests whether the given method returns 'this' (the channel) as per JDK spec.
      Parameters:
      declaringClass - The class declaring the method.
      name - The method name.
      parameterCount - The number of parameters.
      Returns:
      true if the method returns 'this', false otherwise.
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Specified by:
      invoke in interface InvocationHandler
      Throws:
      Throwable
    • invokeObjectMethod

      private Object invokeObjectMethod(Object proxy, Method method, Object[] args)