org.linkedin.util-core/src/main/java/org/linkedin/util/lifecycle/ShutdownProxy.java
public static Object createShutdownProxy(Object o,
                                           Class[] interfaces,
                                           Shutdown shutdown)
  {
    if(interfaces == null)
      interfaces = ReflectUtils.extractAllInterfaces(o);

    return Proxy.newProxyInstance(o.getClass().getClassLoader(),
                                  interfaces,
                                  new ShutdownProxy(o, shutdown));

  }
public static Object createShutdownProxy(Object o,
                                           Class[] interfaces,
                                           Shutdown shutdown)
  {
    if(interfaces == null)
      interfaces = ReflectUtils.extractAllInterfaces(o);

    return Proxy.newProxyInstance(o.getClass().getClassLoader(),
                                  interfaces,
                                  new ShutdownProxy(o, shutdown));

  }
Creates the proxy to check for shutdown.

@param o
@param interfaces restriction on which interface to apply the proxy on
@param shutdown
@return the proxy