register RemoteRpcRegistryMXBean 35/66635/5
authorwusandi <wusandi@163.com>
Wed, 20 Dec 2017 07:09:12 +0000 (15:09 +0800)
committerTom Pantelis <tompantelis@gmail.com>
Sun, 7 Jan 2018 01:47:16 +0000 (01:47 +0000)
The RemoteRpcRegistryMXBean had not registered because of code refactoring.
I'm sure that it had been removed from one of history commits,
But I think it should be added back to support jmx for query rpcs
when one of rpcs breaks down.

Change-Id: I506ed5c25c7615b8bb7ac9c0102bf671ff40bb78
Signed-off-by: wusandi <wusandi@163.com>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java

index 40600d0..fe43a69 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.Remo
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.UpdateRemoteEndpoints;
 import org.opendaylight.controller.remote.rpc.registry.gossip.Bucket;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStoreActor;
+import org.opendaylight.controller.remote.rpc.registry.mbeans.RemoteRpcRegistryMXBeanImpl;
 
 /**
  * Registry to look up cluster nodes that have registered for a given RPC.
@@ -39,10 +40,12 @@ import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStoreActor;
  */
 public class RpcRegistry extends BucketStoreActor<RoutingTable> {
     private final ActorRef rpcRegistrar;
+    private final RemoteRpcRegistryMXBeanImpl mxBean;
 
     public RpcRegistry(final RemoteRpcProviderConfig config, final ActorRef rpcInvoker, final ActorRef rpcRegistrar) {
         super(config, config.getRpcRegistryPersistenceId(), new RoutingTable(rpcInvoker, ImmutableSet.of()));
         this.rpcRegistrar = Preconditions.checkNotNull(rpcRegistrar);
+        this.mxBean = new RemoteRpcRegistryMXBeanImpl(this);
     }
 
     /**
@@ -58,6 +61,12 @@ public class RpcRegistry extends BucketStoreActor<RoutingTable> {
         return Props.create(RpcRegistry.class, config, rpcInvoker, rpcRegistrar);
     }
 
+    @Override
+    public void postStop() {
+        super.postStop();
+        this.mxBean.unregister();
+    }
+
     @Override
     protected void handleCommand(final Object message) throws Exception {
         if (message instanceof AddOrUpdateRoutes) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.