Logger logger = getLogger();
// Find operation descriptor
ModelMBeanInfo info = getModelMBeanInfo();
if (info == null) throw new MBeanException(new ServiceNotFoundException("ModelMBeanInfo is null"));
if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("ModelMBeanInfo is: " + info);
// This is a clone, we use it read only
ModelMBeanOperationInfo operInfo = info.getOperation(method);
if (operInfo == null)
{
// Bug #940161 Required ModelMBean methods are not invoked
try
{
// Look in RMMB public methods
Class[] clzArgs = new Class[params.length];
for (int i = 0; i < clzArgs.length; i++)
{
ClassLoader loader = getClass().getClassLoader();
if (loader == null) loader = Thread.currentThread().getContextClassLoader();
clzArgs[i] = loader.loadClass(params[i]);
}
// Class.getMethod only returns public methods
Method invocationMethod = getClass().getMethod(method, clzArgs);
operInfo = new ModelMBeanOperationInfo("", invocationMethod);
}
catch (Exception e)
{
throw new MBeanException(new ServiceNotFoundException("Cannot find ModelMBeanOperationInfo for operation " + method));
}
}
if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Operation info is: " + operInfo);
// This descriptor is a clone
Descriptor operationDescriptor = operInfo.getDescriptor();
if (operationDescriptor == null) throw new MBeanException(new ServiceNotFoundException("Operation descriptor for operation " + method + " cannot be null"));
String role = (String)operationDescriptor.getFieldValue("role");
if (role == null || !role.equals("operation")) throw new MBeanException(new ServiceNotFoundException("Operation descriptor field 'role' must be 'operation', not " + role));
if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Operation descriptor is: " + operationDescriptor);
// This returns a clone of the mbean descriptor, we use it read only
Descriptor mbeanDescriptor = info.getMBeanDescriptor();
if (mbeanDescriptor == null) throw new MBeanException(new ServiceNotFoundException("MBean descriptor cannot be null"));
if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("MBean descriptor is: " + mbeanDescriptor);
Object returnValue = null;
String lastUpdateField = "lastReturnedTimeStamp";