Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added unregister MBeans when closing pool

  • Loading branch information...
commit 1197e9b3f3bf8659c94ca7b244134d0681344d5b 1 parent d63c2ed
@zhongjiewu zhongjiewu authored
View
18 src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorPool.java
@@ -16,6 +16,7 @@
package voldemort.store.socket.clientrequest;
+import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import voldemort.VoldemortException;
@@ -26,6 +27,7 @@
import voldemort.store.socket.SocketStore;
import voldemort.store.socket.SocketStoreFactory;
import voldemort.store.stats.ClientSocketStats;
+import voldemort.utils.JmxUtils;
import voldemort.utils.Time;
import voldemort.utils.Utils;
import voldemort.utils.pool.KeyedResourcePool;
@@ -165,6 +167,22 @@ public void close(SocketDestination destination) {
* Close the socket pool
*/
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"));
+ }
factory.close();
pool.close();
View
2  src/java/voldemort/store/stats/ClientSocketStats.java
@@ -210,7 +210,7 @@ public void setPool(KeyedResourcePool<SocketDestination, ClientRequestExecutor>
this.pool = pool;
}
- ConcurrentMap<SocketDestination, ClientSocketStats> getStatsMap() {
+ public ConcurrentMap<SocketDestination, ClientSocketStats> getStatsMap() {
return statsMap;
}
Please sign in to comment.
Something went wrong with that request. Please try again.