X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fimpl%2FRpcProviderRegistryImpl.java;h=f93457110181967063ec64c27a3f29c026320121;hb=ad4199152e5cd75ba2bcfaa96ca3e4485b4d0a56;hp=ffc72657f0e3ef406961738c6c3598ac044ecd9e;hpb=928525541a36fac7aaa672d61417b853d08f7f6c;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java index ffc72657f0..f934571101 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java @@ -56,6 +56,8 @@ public class RpcProviderRegistryImpl implements // private final String name; + private ListenerRegistry globalRpcListeners = ListenerRegistry.create(); + public String getName() { return name; } @@ -86,6 +88,7 @@ public class RpcProviderRegistryImpl implements // checkState(currentDelegate == null, "Rpc service is already registered"); LOG.debug("Registering {} as global implementation of {} in {}", implementation, type.getSimpleName(), this); RuntimeCodeHelper.setDelegate(publicProxy, implementation); + notifyGlobalRpcAdded(type); return new RpcProxyRegistration(type, implementation, this); } @@ -140,6 +143,17 @@ public class RpcProviderRegistryImpl implements // } } + private void notifyGlobalRpcAdded(Class type) { + for(ListenerRegistration listener : globalRpcListeners) { + try { + listener.getInstance().onGlobalRpcRegistered(type); + } catch (Exception e) { + LOG.error("Unhandled exception during invoking listener {}", e); + } + } + + } + private void notifyListenersRoutedCreated(RpcRouter router) { for (ListenerRegistration listener : routerInstantiationListener) { @@ -182,6 +196,16 @@ public class RpcProviderRegistryImpl implements // public interface RouterInstantiationListener extends EventListener { void onRpcRouterCreated(RpcRouter router); } + + public ListenerRegistration registerGlobalRpcRegistrationListener(GlobalRpcRegistrationListener listener) { + return globalRpcListeners.register(listener); + } + + public interface GlobalRpcRegistrationListener extends EventListener { + void onGlobalRpcRegistered(Class cls); + void onGlobalRpcUnregistered(Class cls); + + } private class RouteChangeForwarder implements RouteChangeListener, InstanceIdentifier> {