m_metrics.numberFailedCommands++;
}
String err = LOG
.getMsgString(CommI18NResourceKeys.COMMAND_PROCESSOR_FAILED_AUTHENTICATION, cmd);
ret_response = new GenericCommandResponse(null, false, null, new AuthenticationException(err));
notifyListenersOfProcessedCommand(cmd, ret_response);
return ret_response;
}
}
// get the command's type
CommandType cmdType = cmd.getCommandType();
// ask the directory what command service supports the command we want to execute
CommandServiceDirectoryEntry entry = null;
ObjectName cmdServiceName = null;
entry = getCommandServiceDirectory().getCommandTypeProvider(subsystem, cmdType);
if (entry != null) {
cmdServiceName = entry.getCommandServiceName();
}
if (cmdServiceName != null) {
// now delegate the execution of the command to the command service
CommandServiceMBean executor;
executor = (CommandServiceMBean) MBeanServerInvocationHandler.newProxyInstance(m_mBeanServer,
cmdServiceName, CommandServiceMBean.class, false);
LOG.debug(CommI18NResourceKeys.COMMAND_PROCESSOR_EXECUTING, cmd);
long start = System.currentTimeMillis();
ret_response = executor.execute(cmd, in, null);
elapsed = System.currentTimeMillis() - start;
LOG.debug(CommI18NResourceKeys.COMMAND_PROCESSOR_EXECUTED, ret_response);
} else {
throw new InstanceNotFoundException(LOG.getMsgString(
CommI18NResourceKeys.COMMAND_PROCESSOR_UNSUPPORTED_COMMAND_TYPE, subsystem, cmdType));
}
} else {
LOG.warn(CommI18NResourceKeys.COMMAND_PROCESSOR_MISSING_COMMAND);
ret_response = new GenericCommandResponse(null, false, null, new Exception(LOG
.getMsgString(CommI18NResourceKeys.COMMAND_PROCESSOR_MISSING_COMMAND)));
}
} catch (Throwable t) {
ret_response = new GenericCommandResponse(cmd, false, null, t);
} finally {
IncomingCommandTrace.finish(cmd, ret_response);
// as per JBoss/Remoting docs, you must ensure you close the input stream
if (in != null) {
try {
in.close();
} catch (Throwable t) {
}
}
}
// finish our processing
try {
if (ret_response == null) {
ret_response = new GenericCommandResponse(cmd, false, null, new IllegalStateException(
"results are null"));
}
updateMetrics(cmd, ret_response, elapsed);