X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fimpl%2FRpcProviderRegistryImpl.java;fp=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fimpl%2FRpcProviderRegistryImpl.java;h=952d84d885c41e73fe2312bf22c723f62cc44b35;hp=542dfa7e7bca61a0fc4ff33e31239c3c3872e73b;hb=ac47319b64d6fad519be729699b0064fb52b668c;hpb=7343e5ed39a37cb10bb16d8b153c0e008c704673 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 542dfa7e7b..952d84d885 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 @@ -7,6 +7,15 @@ */ package org.opendaylight.controller.sal.binding.impl; +import static com.google.common.base.Preconditions.checkState; + +import java.util.EventListener; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.WeakHashMap; + import org.opendaylight.controller.md.sal.common.api.routing.RouteChange; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher; @@ -28,15 +37,6 @@ import org.opendaylight.yangtools.yang.binding.RpcService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.EventListener; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.WeakHashMap; - -import static com.google.common.base.Preconditions.checkState; - public class RpcProviderRegistryImpl implements // RpcProviderRegistry, // RouteChangePublisher> { @@ -60,19 +60,19 @@ public class RpcProviderRegistryImpl implements // return name; } - public RpcProviderRegistryImpl(String name) { + public RpcProviderRegistryImpl(final String name) { super(); this.name = name; } @Override - public final RoutedRpcRegistration addRoutedRpcImplementation(Class type, - T implementation) throws IllegalStateException { + public final RoutedRpcRegistration addRoutedRpcImplementation(final Class type, + final T implementation) throws IllegalStateException { return getRpcRouter(type).addRoutedRpcImplementation(implementation); } @Override - public final RpcRegistration addRpcImplementation(Class type, T implementation) + public final RpcRegistration addRpcImplementation(final Class type, final T implementation) throws IllegalStateException { @SuppressWarnings("unchecked") RpcRouter potentialRouter = (RpcRouter) rpcRouters.get(type); @@ -92,7 +92,7 @@ public class RpcProviderRegistryImpl implements // @SuppressWarnings("unchecked") @Override - public final T getRpcService(Class type) { + public final T getRpcService(final Class type) { T potentialProxy = (T) publicProxies.get(type); if (potentialProxy != null) { @@ -115,8 +115,8 @@ public class RpcProviderRegistryImpl implements // } } - @SuppressWarnings("unchecked") - public RpcRouter getRpcRouter(Class type) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + public RpcRouter getRpcRouter(final Class type) { RpcRouter potentialRouter = rpcRouters.get(type); if (potentialRouter != null) { return (RpcRouter) potentialRouter; @@ -140,7 +140,7 @@ public class RpcProviderRegistryImpl implements // } } - private void notifyGlobalRpcAdded(Class type) { + private void notifyGlobalRpcAdded(final Class type) { for(ListenerRegistration listener : globalRpcListeners) { try { listener.getInstance().onGlobalRpcRegistered(type); @@ -151,7 +151,7 @@ public class RpcProviderRegistryImpl implements // } - private void notifyListenersRoutedCreated(RpcRouter router) { + private void notifyListenersRoutedCreated(final RpcRouter router) { for (ListenerRegistration listener : routerInstantiationListener) { try { @@ -164,7 +164,7 @@ public class RpcProviderRegistryImpl implements // } public ListenerRegistration registerRouterInstantiationListener( - RouterInstantiationListener listener) { + final RouterInstantiationListener listener) { ListenerRegistration reg = routerInstantiationListener.register(listener); try { for (RpcRouter router : rpcRouters.values()) { @@ -176,9 +176,10 @@ public class RpcProviderRegistryImpl implements // return reg; } + @SuppressWarnings("unchecked") @Override public >> ListenerRegistration registerRouteChangeListener( - L listener) { + final L listener) { return (ListenerRegistration) routeChangeListeners.register(listener); } @@ -186,7 +187,7 @@ public class RpcProviderRegistryImpl implements // return rpcFactory; } - public void setRpcFactory(RuntimeCodeGenerator rpcFactory) { + public void setRpcFactory(final RuntimeCodeGenerator rpcFactory) { this.rpcFactory = rpcFactory; } @@ -194,7 +195,7 @@ public class RpcProviderRegistryImpl implements // void onRpcRouterCreated(RpcRouter router); } - public ListenerRegistration registerGlobalRpcRegistrationListener(GlobalRpcRegistrationListener listener) { + public ListenerRegistration registerGlobalRpcRegistrationListener(final GlobalRpcRegistrationListener listener) { return globalRpcListeners.register(listener); } @@ -209,12 +210,12 @@ public class RpcProviderRegistryImpl implements // private final Class type; - public RouteChangeForwarder(Class type) { + public RouteChangeForwarder(final Class type) { this.type = type; } @Override - public void onRouteChange(RouteChange, InstanceIdentifier> change) { + public void onRouteChange(final RouteChange, InstanceIdentifier> change) { Map>> announcements = new HashMap<>(); for (Entry, Set>> entry : change.getAnnouncements() .entrySet()) { @@ -245,7 +246,7 @@ public class RpcProviderRegistryImpl implements // private final Class serviceType; private RpcProviderRegistryImpl registry; - public RpcProxyRegistration(Class type, T service, RpcProviderRegistryImpl registry) { + public RpcProxyRegistration(final Class type, final T service, final RpcProviderRegistryImpl registry) { super(service); this.serviceType = type; this.registry = registry;