*/
private synchronized void initialize() throws Exception {
MBeanServer server = getContainerWrapper().getResourceResolver().getMBeanServer();
String serverName = getContainerWrapper().getTomcatContainer().getName();
Set threadPools = server.queryMBeans(new ObjectName(serverName + ":type=ThreadPool,*"), null);
poolNames = new ArrayList(threadPools.size());
for (Iterator it = threadPools.iterator(); it.hasNext();) {
ThreadPoolObjectName threadPoolObjectName = new ThreadPoolObjectName();
ObjectName threadPoolName = ((ObjectInstance) it.next()).getObjectName();
String name = threadPoolName.getKeyProperty("name");
threadPoolObjectName.setThreadPoolName(threadPoolName);
ObjectName grpName = server.getObjectInstance(
new ObjectName(threadPoolName.getDomain() + ":type=GlobalRequestProcessor,name=" + name)).getObjectName();
threadPoolObjectName.setGlobalRequestProcessorName(grpName);
//
// unfortunately exact workers could not be found at the time of testing
// so we filter out the relevant workers within the loop
//
Set workers = server.queryMBeans(new ObjectName(threadPoolName.getDomain() + ":type=RequestProcessor,*"), null);
for (Iterator wrkIt = workers.iterator(); wrkIt.hasNext();) {
ObjectName wrkName = ((ObjectInstance) wrkIt.next()).getObjectName();
if (name.equals(wrkName.getKeyProperty("worker"))) {
threadPoolObjectName.getRequestProcessorNames().add(wrkName);
}
}
poolNames.add(threadPoolObjectName);
}
Set executors = server.queryMBeans(new ObjectName(serverName + ":type=Executor,*"), null);
executorNames = new ArrayList(executors.size());
for (Iterator it = executors.iterator(); it.hasNext();) {
ObjectName executorName = ((ObjectInstance) it.next()).getObjectName();
executorNames.add(executorName);
}
// Register with MBean server
server.addNotificationListener(new ObjectName("JMImplementation:type=MBeanServerDelegate"), this, null, null);
}