X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2Fregistry%2FRpcRegistry.java;fp=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2Fregistry%2FRpcRegistry.java;h=fe43a691d2d685ee0c9fa16f0251c3e925d1c5be;hp=40600d091e16345a61c9dbb9ecfe9096d89b6040;hb=105587c7c4068aa8a0721669cff6aae7f28f6492;hpb=282a8afa481508d1c749d87502c6224932c8b36a diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java index 40600d091e..fe43a691d2 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java @@ -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 { 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 { 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) {