Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
BUG-4514: clear destroyed modules
[controller.git]
/
opendaylight
/
config
/
config-manager
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
config
/
manager
/
impl
/
jmx
/
InternalJMXRegistrator.java
diff --git
a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/jmx/InternalJMXRegistrator.java
b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/jmx/InternalJMXRegistrator.java
index 98f0908dc710cf40fbb93b88004d411d03f594fd..85ad8c51340c045cc051150ec9e6159fc7144fbb 100644
(file)
--- a/
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/jmx/InternalJMXRegistrator.java
+++ b/
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/jmx/InternalJMXRegistrator.java
@@
-7,9
+7,12
@@
*/
package org.opendaylight.controller.config.manager.impl.jmx;
*/
package org.opendaylight.controller.config.manager.impl.jmx;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import java.io.Closeable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import javax.annotation.concurrent.GuardedBy;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.annotation.concurrent.GuardedBy;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
@@
-19,15
+22,11
@@
import javax.management.MBeanServer;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import javax.management.QueryExp;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import javax.management.QueryExp;
-import java.io.Closeable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class InternalJMXRegistrator implements Closeable {
public class InternalJMXRegistrator implements Closeable {
- private static final Logger
logger
= LoggerFactory
+ private static final Logger
LOG
= LoggerFactory
.getLogger(InternalJMXRegistrator.class);
private final MBeanServer configMBeanServer;
.getLogger(InternalJMXRegistrator.class);
private final MBeanServer configMBeanServer;
@@
-53,6
+52,7
@@
public class InternalJMXRegistrator implements Closeable {
@GuardedBy("this")
private final Set<ObjectName> registeredObjectNames = new HashSet<>();
@GuardedBy("this")
private final Set<ObjectName> registeredObjectNames = new HashSet<>();
+ @GuardedBy("this")
private final List<InternalJMXRegistrator> children = new ArrayList<>();
public synchronized InternalJMXRegistration registerMBean(Object object,
private final List<InternalJMXRegistrator> children = new ArrayList<>();
public synchronized InternalJMXRegistration registerMBean(Object object,
@@
-79,9
+79,8
@@
public class InternalJMXRegistrator implements Closeable {
}
}
}
}
- public InternalJMXRegistrator createChild() {
- InternalJMXRegistrator child = new InternalJMXRegistrator(
- configMBeanServer);
+ public synchronized InternalJMXRegistrator createChild() {
+ InternalJMXRegistrator child = new InternalJMXRegistrator(configMBeanServer);
children.add(child);
return child;
}
children.add(child);
return child;
}
@@
-100,7
+99,7
@@
public class InternalJMXRegistrator implements Closeable {
try {
configMBeanServer.unregisterMBean(on);
} catch (Exception e) {
try {
configMBeanServer.unregisterMBean(on);
} catch (Exception e) {
-
logger
.warn("Ignoring error while unregistering {}", on, e);
+
LOG
.warn("Ignoring error while unregistering {}", on, e);
}
}
registeredObjectNames.clear();
}
}
registeredObjectNames.clear();
@@
-137,7
+136,7
@@
public class InternalJMXRegistrator implements Closeable {
return getSameNames(result);
}
return getSameNames(result);
}
- private Set<ObjectName> getSameNames(Set<ObjectName> superSet) {
+ private
synchronized
Set<ObjectName> getSameNames(Set<ObjectName> superSet) {
Set<ObjectName> result = new HashSet<>(superSet);
result.retainAll(registeredObjectNames);
for (InternalJMXRegistrator child : children) {
Set<ObjectName> result = new HashSet<>(superSet);
result.retainAll(registeredObjectNames);
for (InternalJMXRegistrator child : children) {