@Override
  public synchronized Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if ("close".equals(method.getName())) {
      if (this.currentConnector != null) {
        try {
          this.currentConnector.close();
        }
        finally {
          this.currentConnector = null;
        }
      }
      return null;
    }

    if (this.currentConnector == null) {
      ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
      try {
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        this.currentConnector = getConnector();
      }
      catch (IOException e) {
        this.currentConnector = null;
        throw new JmxCallException("Unable to connect to JMX host", e);
      }
      finally {
        Thread.currentThread().setContextClassLoader(originalClassLoader);
      }
    }

    try {
      MBeanServerConnection mbsc = this.currentConnector.getMBeanServerConnection();

      MBeanServerInvocationHandler wrappedHandler = new MBeanServerInvocationHandler(mbsc, mbeanName);
      return wrappedHandler.invoke(proxy, method, args);
    }
    catch (IOException e) {
      throw new JmxCallException("Unable to perform JMX call", e);
    }
  }
@Override
  public synchronized Object invoke(Object proxy, Method method, Object[] args)