@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Object result;
        JMXConnector connector = null;
        
        try {

            // Connect to the JMX service.
            connector = connect(this.host, this.port, this.login, this.password);

            // Create the MBean.
            T object = JMX.newMXBeanProxy(connector.getMBeanServerConnection(), this.objectName, this.interfaceClass);

            // Invoke a method on the MBean.
            result = method.invoke(object, args);
        }
        finally {

            // Close the JMX service.
            close(connector);
        }

        return result;
    }
@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Object result;
        JMXConnector connector = null;
        
        try {

            
            connector = connect(this.host, this.port, this.login, this.password);

            
            T object = JMX.newMXBeanProxy(connector.getMBeanServerConnection(), this.objectName, this.interfaceClass);

            
            result = method.invoke(object, args);
        }
        finally {

            
            close(connector);
        }

        return result;
    }
@ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { Object result ; JMXConnector connector = null ; try { // Connect to the JMX service. connector = connect ( this . host , this . port , this . login , this . password ) ; // Create the MBean. T object = JMX . newMXBeanProxy ( connector . getMBeanServerConnection ( ) , this . objectName , this . interfaceClass ) ; // Invoke a method on the MBean. result = method . invoke ( object , args ) ; } finally { // Close the JMX service. close ( connector ) ; } return result ; }
Invoke the method and return the result.

@param  proxy   the proxy.
@param  method  the method.
@param  args    the method arguments.

@return  the result of invoking the method.

@throws  Throwable  if unable to invoke the method.
Invoke the method and return the result .