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%2Fcodegen%2Fimpl%2FRpcRoutingTableImpl.java;h=808358fb3503c1ea38bca66951137c1353c7b64d;hp=f9592351f6ea04b706abdd1df83ddc27d44ef410;hb=178d185be418a9ed491201bd6a0e4d98efa9d820;hpb=523c3f0629438462c5bb7be4adcaf7103a3f7ea6 diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java index f9592351f6..808358fb35 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java @@ -15,8 +15,11 @@ import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublishe import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils; import org.opendaylight.yangtools.concepts.AbstractObjectRegistration; +import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Mutable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class RpcRoutingTableImpl // implements // @@ -24,16 +27,22 @@ implements // RpcRoutingTable, // RouteChangePublisher, InstanceIdentifier> { - private final Class identifier; + private static final Logger LOGGER = LoggerFactory.getLogger(RpcRoutingTableImpl.class); + private final String routerName; + private final Class serviceType; + + private final Class contextType; private final ConcurrentMap, S> routes; private final Map, S> unmodifiableRoutes; private RouteChangeListener, InstanceIdentifier> listener; private S defaultRoute; - - public RpcRoutingTableImpl(Class identifier) { + + public RpcRoutingTableImpl(String routerName,Class contextType, Class serviceType) { super(); - this.identifier = identifier; + this.routerName = routerName; + this.serviceType = serviceType; + this.contextType = contextType; this.routes = new ConcurrentHashMap<>(); this.unmodifiableRoutes = Collections.unmodifiableMap(routes); } @@ -56,17 +65,19 @@ implements // @Override public Class getIdentifier() { - return identifier; + return contextType; } @Override @SuppressWarnings("unchecked") public void updateRoute(InstanceIdentifier path, S service) { S previous = this.routes.put(path, service); + + LOGGER.debug("Route {} updated to {} in routing table {}",path,service,this); @SuppressWarnings("rawtypes") RouteChangeListener listenerCapture = listener; if (previous == null && listenerCapture != null) { - listenerCapture.onRouteChange(RoutingUtils.announcementChange(identifier, path)); + listenerCapture.onRouteChange(RoutingUtils.announcementChange(contextType, path)); } } @@ -75,10 +86,11 @@ implements // @SuppressWarnings("unchecked") public void removeRoute(InstanceIdentifier path) { S previous = this.routes.remove(path); + LOGGER.debug("Route {} to {} removed in routing table {}",path,previous,this); @SuppressWarnings("rawtypes") RouteChangeListener listenerCapture = listener; if (previous != null && listenerCapture != null) { - listenerCapture.onRouteChange(RoutingUtils.removalChange(identifier, path)); + listenerCapture.onRouteChange(RoutingUtils.removalChange(contextType, path)); } } @@ -86,7 +98,8 @@ implements // @SuppressWarnings("rawtypes") RouteChangeListener listenerCapture = listener; if (routes.remove(path, service) && listenerCapture != null) { - listenerCapture.onRouteChange(RoutingUtils.removalChange(identifier, path)); + LOGGER.debug("Route {} to {} removed in routing table {}",path,service,this); + listenerCapture.onRouteChange(RoutingUtils.removalChange(contextType, path)); } } @@ -107,6 +120,16 @@ implements // protected void removeAllReferences(S service) { } + + + + @Override + public String toString() { + return "RpcRoutingTableImpl [router=" + routerName + ", service=" + serviceType.getSimpleName() + ", context=" + + contextType.getSimpleName() + "]"; + } + + private class SingletonListenerRegistration, InstanceIdentifier>> extends AbstractObjectRegistration