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=2c89f1426072a6e945de5ed107fd3b07a53ef7df;hp=8e0b9c51eab5a4f646ec0ae568271fc3994119c8;hb=73b088ee110766618a8728eed653b15cef896cf1;hpb=63b517a3b39d0017a14145ec839b29861f3b03c6 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 8e0b9c51ea..2c89f14260 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 @@ -42,13 +42,12 @@ import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier; */ public class RpcRegistry extends BucketStoreActor { private final ActorRef rpcRegistrar; - private final RemoteRpcRegistryMXBeanImpl mxBean; + private RemoteRpcRegistryMXBeanImpl mxBean; public RpcRegistry(final RemoteOpsProviderConfig config, final ActorRef rpcInvoker, final ActorRef rpcRegistrar) { super(config, config.getRpcRegistryPersistenceId(), new RoutingTable(rpcInvoker, ImmutableSet.of())); this.rpcRegistrar = requireNonNull(rpcRegistrar); - this.mxBean = new RemoteRpcRegistryMXBeanImpl(new BucketStoreAccess(self(), getContext().dispatcher(), - config.getAskDuration()), config.getAskDuration()); + } /** @@ -64,10 +63,20 @@ public class RpcRegistry extends BucketStoreActor { return Props.create(RpcRegistry.class, config, rpcInvoker, rpcRegistrar); } + @Override + public void preStart() { + super.preStart(); + mxBean = new RemoteRpcRegistryMXBeanImpl(new BucketStoreAccess(self(), getContext().dispatcher(), + getConfig().getAskDuration()), getConfig().getAskDuration()); + } + @Override public void postStop() throws Exception { + if (mxBean != null) { + mxBean.unregister(); + mxBean = null; + } super.postStop(); - this.mxBean.unregister(); } @Override