public void init(String host, int port) throws Exception {
int iport = 0;
String shost = null;
mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
String onStr = "*:type=ThreadPool,*";
ObjectName objectName = new ObjectName(onStr);
Set<ObjectInstance> set = mBeanServer.queryMBeans(objectName, null);
Iterator<ObjectInstance> iterator = set.iterator();
while (iterator.hasNext()) {
ObjectInstance oi = iterator.next();
objName = oi.getObjectName();
String name = objName.getKeyProperty("name");
/* Name are:
* http-8080
* jk-10.33.144.3-8009
* jk-jfcpc%2F10.33.144.3-8009
*/
String [] elenames = name.split("-");
String sport = elenames[elenames.length-1];
iport = Integer.parseInt(sport);
String [] shosts = elenames[1].split("%2F");
shost = shosts[0];
if (port==0 && host==null)
break; /* Take the first one */
if (host==null && iport==port)
break; /* Only port done */
if (shost.compareTo(host) == 0)
break; /* Done port and host are the expected ones */
}
if (objName == null)
throw(new Exception("Can't find connector for " + host + ":" + port));
this.port = iport;
this.host = shost;
}
CollectedInfo.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:tomcat7
作者:
评论列表
文章目录