tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38216] Extend Jmxproxy to allow call of MBean Operations
Date Tue, 17 Jan 2012 14:49:57 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=38216

Chris O'Connor <tomcat@croconnor.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #6 from Chris O'Connor <tomcat@croconnor.co.uk> 2012-01-17 14:49:57 UTC
---
Very useful feature and i'm just putting it onto our tomcat 6 boxes. However it
doesn't account for the invocation of the mbean returning null when outputting
the result. I propose that the invokeOperation becomes

    public void invokeOperation(PrintWriter writer, String onameStr, String op,
String[] valuesStr){
        try {
            ObjectName oname=new ObjectName( onameStr );
            MBeanOperationInfo methodInfo = registry.getMethodInfo(oname,op);
            MBeanParameterInfo[] signature = methodInfo.getSignature();
            String[] signatureTypes = new String[signature.length];
            Object[] values = new Object[signature.length];
            for (int i = 0; i < signature.length; i++) {
               MBeanParameterInfo pi = signature[i];
               signatureTypes[i] = pi.getType();
               values[i] = registry.convertValue(pi.getType(), valuesStr[i] );
           }

            Object retVal = mBeanServer.invoke(oname,op,values,signatureTypes);
            if(retVal != null){
                writer.println("OK - Operation " + op + " returned:");
                output("", writer, retVal);
            }else{
                writer.println("OK - Operation " + op + " without return
value");
            }
        } catch( Exception ex ) {
            writer.println("Error - " + ex.toString());
            ex.printStackTrace(writer);
        }
    }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message