mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
handle MBean preRegister method, if exists, unregister.
This commit is contained in:
@@ -2879,8 +2879,15 @@ public class DruidDataSource extends DruidAbstractDataSource
|
||||
|
||||
@Override
|
||||
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
|
||||
//do nothing
|
||||
//return original name to avoid NullPointerException
|
||||
if (server != null) {
|
||||
try {
|
||||
if (server.isRegistered(name)) {
|
||||
server.unregisterMBean(name);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.warn("DruidDataSource preRegister error", ex);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user