bug fixed for mbean register

This commit is contained in:
wenshao
2014-12-16 22:05:53 +08:00
parent fbb27230e1
commit 3ad88f639a
2 changed files with 16 additions and 3 deletions
@@ -127,10 +127,19 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
}
public synchronized static ObjectName addDataSource(Object dataSource, String name) {
if (dataSource == null || name == null) {
return null;
}
final IdentityHashMap<Object, ObjectName> instances = getInstances();
synchronized (instances) {
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
if (mbeanServer == null) {
return null;
}
if (instances.size() == 0) {
try {