Skip to content
Browse files

Adding jmxId to the Mbean name for failureDetector and storefactory

  • Loading branch information...
1 parent dc19e82 commit d1b9bb82115addcddfc60c000064162085025cf8 Chinmay Soman committed Jun 18, 2012
View
9 src/java/voldemort/client/AbstractStoreClientFactory.java
@@ -274,8 +274,13 @@ public FailureDetector getFailureDetector() {
synchronized(this) {
// second check: avoids double initialization
result = failureDetector;
- if(result == null)
+ if(result == null) {
failureDetector = result = initFailureDetector(config, cluster.getNodes());
+ JmxUtils.registerMbean(failureDetector,
+ JmxUtils.createObjectName(JmxUtils.getPackageName(failureDetector.getClass()),
+ JmxUtils.getClassName(failureDetector.getClass())
+ + jmxId()));
+ }
}
}
@@ -400,7 +405,7 @@ public void close() {
}
/* Give a unique id to avoid jmx clashes */
- private String jmxId() {
+ public String jmxId() {
return jmxId == 0 ? "" : Integer.toString(jmxId);
}
View
11 src/java/voldemort/client/SocketStoreClientFactory.java
@@ -70,7 +70,10 @@ public SocketStoreClientFactory(ClientConfig config) {
config.getSocketBufferSize(),
config.getSocketKeepAlive());
if(config.isJmxEnabled())
- JmxUtils.registerMbean(storeFactory, JmxUtils.createObjectName(storeFactory.getClass()));
+ JmxUtils.registerMbean(storeFactory,
+ JmxUtils.createObjectName(JmxUtils.getPackageName(storeFactory.getClass()),
+ JmxUtils.getClassName(storeFactory.getClass())
+ + jmxId()));
}
@Override
@@ -87,7 +90,8 @@ public SocketStoreClientFactory(ClientConfig config) {
return getParentStoreClient(storeName, resolver);
}
- private <K, V> StoreClient<K, V> getParentStoreClient(String storeName, InconsistencyResolver<Versioned<V>> resolver) {
+ private <K, V> StoreClient<K, V> getParentStoreClient(String storeName,
+ InconsistencyResolver<Versioned<V>> resolver) {
return super.getStoreClient(storeName, resolver);
}
@@ -96,7 +100,8 @@ public SocketStoreClientFactory(ClientConfig config) {
try {
return super.getRemoteMetadata(key, url);
} catch(VoldemortException e) {
- // Fix SNA-4227: When an error occurs during bootstrap, close the socket
+ // Fix SNA-4227: When an error occurs during bootstrap, close the
+ // socket
SocketDestination destination = new SocketDestination(url.getHost(),
url.getPort(),
getRequestFormatType());

0 comments on commit d1b9bb8

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