if (includeRequestProcessors) {
for (Iterator wrkIt = threadPoolObjectName.getRequestProcessorNames().iterator(); wrkIt.hasNext();) {
ObjectName wrkName = (ObjectName) wrkIt.next();
try {
RequestProcessor rp = new RequestProcessor();
rp.setName(wrkName.getKeyProperty("name"));
rp.setStage(JmxTools.getIntAttr(server, wrkName, "stage"));
rp.setProcessingTime(JmxTools.getLongAttr(server, wrkName, "requestProcessingTime"));
rp.setBytesSent(JmxTools.getLongAttr(server, wrkName, "requestBytesSent"));
rp.setBytesReceived(JmxTools.getLongAttr(server, wrkName, "requestBytesReceived"));
try {
String remoteAddr = JmxTools.getStringAttr(server, wrkName, "remoteAddr");
rp.setRemoteAddr(remoteAddr);
rp.setRemoteAddrLocale(InetAddressLocator.getLocale(InetAddress.getByName(remoteAddr).getAddress()));
} catch (RuntimeOperationsException ex) {
/*
* if it's not available for this request processor, then it's
* not available for any request processor in this thread pool
*/
remoteAddrAvailable = false;
}
rp.setVirtualHost(JmxTools.getStringAttr(server, wrkName, "virtualHost"));
rp.setMethod(JmxTools.getStringAttr(server, wrkName, "method"));
rp.setCurrentUri(JmxTools.getStringAttr(server, wrkName, "currentUri"));
rp.setCurrentQueryString(JmxTools.getStringAttr(server, wrkName, "currentQueryString"));
rp.setProtocol(JmxTools.getStringAttr(server, wrkName, "protocol"));
// Relies on https://issues.apache.org/bugzilla/show_bug.cgi?id=41128
if (workerThreadNameSupported && JmxTools.hasAttribute(server, wrkName, "workerThreadName")) {
rp.setWorkerThreadName(JmxTools.getStringAttr(server, wrkName, "workerThreadName"));
rp.setWorkerThreadNameSupported(true);
} else {
//
// attribute should consistently either exist or be missing across all the workers so
// it does not make sense to check attribute existence
// if we have found once that it is not supported
//
rp.setWorkerThreadNameSupported(false);
workerThreadNameSupported = false;
}
connector.addRequestProcessor(rp);
} catch (InstanceNotFoundException e) {
logger.info("Failed to query RequestProcessor " + wrkName);