我们注意到在Web应用程序中使用JBOSS jmx远程处理库时内存泄漏
我们初始化JMX连接工厂,如下所示
try {
this.jmxConnector = JMXConnectorFactory.connect(serviceURL, auth);
if (this.jmxConnector != null) {
MBeanServerConnection mbs = this.jmxConnector.getMBeanServerConnection();
if (mbs != null) {
this.mbs = mbs;
}
}
} catch (IOException e) {
connected = false;
}
然后在计划的间隔(例如60秒)之后使用mbean服务器连接从mbean服务器连接上方读取mbeans。
private Map<String, Object> getAttributesForMBean(ObjectName objectName, List<String> attributeNames) {
HashMap<String, Object> attributeMap = new HashMap<String, Object>();
for (String attributeName : attributeNames) {
Object attributeValue = null;
if (this.hasAttribute(objectName, attributeName)) {
try {
attributeValue = this.mbs.getAttribute(objectName, attributeName);
} catch (Exception e) {
logger.warn("In getAttributes(), for " + objectName + ": " , e);
}
}
attributeMap.put(attributeName, attributeValue);
}
return attributeMap;
}
我们看到RemoteConnectionChannel不断累积XnioWorkerTaskPool并导致内存泄漏。
如果有人在使用org / jboss / remotingjmx / remoting-jmx / library
之前有任何问题,请告诉我。