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%2FRemoteRpcProvider.java;h=80aebd1918a33e5fa588ec13348e11a4515f32e3;hp=bdfdfc2832c45fecc4fe0680e44a768569c62811;hb=b3b985fc482c43274ea1f8fa70c05ed16d96af4d;hpb=b8c6400766f7324dd57d059bd48e435569fe1a27 diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java index bdfdfc2832..80aebd1918 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java @@ -37,7 +37,8 @@ public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContext private ListenerRegistration schemaListenerRegistration; private final ActorSystem actorSystem; - private Broker.ProviderSession brokerSession; + private SchemaService schemaService; + private DOMRpcService rpcService; private SchemaContext schemaContext; private ActorRef rpcManager; private final RemoteRpcProviderConfig config; @@ -51,6 +52,14 @@ public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContext this.config = Preconditions.checkNotNull(config); } + public void setRpcService(DOMRpcService rpcService) { + this.rpcService = rpcService; + } + + public void setSchemaService(SchemaService schemaService) { + this.schemaService = schemaService; + } + @Override public void close() throws Exception { if (schemaListenerRegistration != null) { @@ -61,7 +70,8 @@ public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContext @Override public void onSessionInitiated(final Broker.ProviderSession session) { - brokerSession = session; + schemaService = session.getService(SchemaService.class); + rpcService = session.getService(DOMRpcService.class); start(); } @@ -70,11 +80,9 @@ public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContext return null; } - private void start() { + public void start() { LOG.info("Starting remote rpc service..."); - final SchemaService schemaService = brokerSession.getService(SchemaService.class); - final DOMRpcService rpcService = brokerSession.getService(DOMRpcService.class); schemaContext = schemaService.getGlobalContext(); rpcManager = actorSystem.actorOf(RpcManager.props(schemaContext, rpcProvisionRegistry, rpcService, config), config.getRpcManagerName());