Skip to content

Commit

Permalink
moved unregistering of the child stats beans into the parent stats
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongjiewu committed Jun 19, 2012
1 parent 320203f commit f527daa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
Expand Up @@ -16,7 +16,6 @@

package voldemort.store.socket.clientrequest;

import java.util.Iterator;
import java.util.concurrent.TimeUnit;

import voldemort.VoldemortException;
Expand Down Expand Up @@ -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() {
Expand Down
17 changes: 17 additions & 0 deletions src/java/voldemort/store/stats/ClientSocketStats.java
Expand Up @@ -217,4 +217,21 @@ public ConcurrentMap<SocketDestination, ClientSocketStats> getStatsMap() {
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.