mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mbean register
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user