Skip to content
Browse files

moved unregistering of the child stats beans into the parent stats

  • Loading branch information...
1 parent 320203f commit f527daa2d631931145f82fa08c2cf344e525307e @zhongjiewu zhongjiewu committed Jun 12, 2012
View
20 src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorPool.java
@@ -16,7 +16,6 @@
package voldemort.store.socket.clientrequest;
-import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import voldemort.VoldemortException;
@@ -176,23 +175,14 @@ public void close(SocketDestination destination) {
public void close() {
// unregister MBeans
if(stats != null) {
- Iterator<SocketDestination> it = stats.getStatsMap().keySet().iterator();
- while(it.hasNext()) {
- try {
- SocketDestination destination = it.next();
- JmxUtils.unregisterMbean(JmxUtils.createObjectName(JmxUtils.getPackageName(ClientRequestExecutor.class),
- "stats_"
- + destination.toString()
- .replace(':',
- '_')));
- } catch(Exception e) {}
- }
- JmxUtils.unregisterMbean(JmxUtils.createObjectName(JmxUtils.getPackageName(ClientRequestExecutor.class),
- "aggregated"));
+ try {
+ JmxUtils.unregisterMbean(JmxUtils.createObjectName(JmxUtils.getPackageName(ClientRequestExecutor.class),
+ "aggregated"));
+ } catch(Exception e) {}
+ stats.close();
}
factory.close();
pool.close();
-
}
public ClientSocketStats getStats() {
View
17 src/java/voldemort/store/stats/ClientSocketStats.java
@@ -217,4 +217,21 @@ public void setPool(KeyedResourcePool<SocketDestination, ClientRequestExecutor>
SocketDestination getDestination() {
return destination;
}
+
+ /**
+ * Unregister all MBeans
+ */
+ public void close() {
+ Iterator<SocketDestination> it = getStatsMap().keySet().iterator();
+ while(it.hasNext()) {
+ try {
+ SocketDestination destination = it.next();
+ JmxUtils.unregisterMbean(JmxUtils.createObjectName(JmxUtils.getPackageName(ClientRequestExecutor.class),
+ "stats_"
+ + destination.toString()
+ .replace(':',
+ '_')));
+ } catch(Exception e) {}
+ }
+ }
}

0 comments on commit f527daa

Please sign in to comment.
Something went wrong with that request. Please try again.