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%2Fmbeans%2FRemoteRpcRegistryMXBeanImpl.java;h=eabb170db244ce260a65dcb8e2dde86eb304be21;hp=339d4b1a3285b58ac1203523b996c8a268b9fb9d;hb=5b66dd8f5e3467a07e77b20fe696b29993ce5565;hpb=d04b71990a802071a786fe8f0df57bc4adbdec3f diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImpl.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImpl.java index 339d4b1a32..eabb170db2 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImpl.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImpl.java @@ -15,10 +15,10 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier; import org.opendaylight.controller.remote.rpc.registry.RoutingTable; import org.opendaylight.controller.remote.rpc.registry.RpcRegistry; import org.opendaylight.controller.remote.rpc.registry.gossip.Bucket; -import org.opendaylight.controller.sal.connector.api.RpcRouter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,8 +27,6 @@ public class RemoteRpcRegistryMXBeanImpl extends AbstractMXBean implements Remot protected final Logger log = LoggerFactory.getLogger(getClass()); - private static final String NULL_CONSTANT = "null"; - private static final String LOCAL_CONSTANT = "local"; private static final String ROUTE_CONSTANT = "route:"; @@ -47,9 +45,9 @@ public class RemoteRpcRegistryMXBeanImpl extends AbstractMXBean implements Remot public Set getGlobalRpc() { RoutingTable table = rpcRegistry.getLocalData(); Set globalRpc = new HashSet<>(table.getRoutes().size()); - for (RpcRouter.RouteIdentifier route : table.getRoutes()) { - if (route.getRoute() == null) { - globalRpc.add(route.getType() != null ? route.getType().toString() : NULL_CONSTANT); + for (DOMRpcIdentifier route : table.getRoutes()) { + if (route.getContextReference().isEmpty()) { + globalRpc.add(route.getType().toString()); } } @@ -61,11 +59,10 @@ public class RemoteRpcRegistryMXBeanImpl extends AbstractMXBean implements Remot public Set getLocalRegisteredRoutedRpc() { RoutingTable table = rpcRegistry.getLocalData(); Set routedRpc = new HashSet<>(table.getRoutes().size()); - for (RpcRouter.RouteIdentifier route : table.getRoutes()) { - if (route.getRoute() != null) { + for (DOMRpcIdentifier route : table.getRoutes()) { + if (!route.getContextReference().isEmpty()) { StringBuilder builder = new StringBuilder(ROUTE_CONSTANT); - builder.append(route.getRoute().toString()).append(NAME_CONSTANT).append(route.getType() != null - ? route.getType().toString() : NULL_CONSTANT); + builder.append(route.getContextReference().toString()).append(NAME_CONSTANT).append(route.getType()); routedRpc.add(builder.toString()); } } @@ -111,15 +108,14 @@ public class RemoteRpcRegistryMXBeanImpl extends AbstractMXBean implements Remot */ private static Map getRpcMemberMapByRoute(final RoutingTable table, final String routeName, final String address) { - Set> routes = table.getRoutes(); + Set routes = table.getRoutes(); Map rpcMap = new HashMap<>(routes.size()); - for (RpcRouter.RouteIdentifier route : table.getRoutes()) { - if (route.getRoute() != null) { - String routeString = route.getRoute().toString(); + for (DOMRpcIdentifier route : routes) { + if (!route.getContextReference().isEmpty()) { + String routeString = route.getContextReference().toString(); if (routeString.contains(routeName)) { StringBuilder builder = new StringBuilder(ROUTE_CONSTANT); - builder.append(routeString).append(NAME_CONSTANT).append(route.getType() != null - ? route.getType().toString() : NULL_CONSTANT); + builder.append(routeString).append(NAME_CONSTANT).append(route.getType()); rpcMap.put(builder.toString(), address); } } @@ -132,15 +128,14 @@ public class RemoteRpcRegistryMXBeanImpl extends AbstractMXBean implements Remot */ private static Map getRpcMemberMapByName(final RoutingTable table, final String name, final String address) { - Set> routes = table.getRoutes(); + Set routes = table.getRoutes(); Map rpcMap = new HashMap<>(routes.size()); - for (RpcRouter.RouteIdentifier route : routes) { - if (route.getType() != null) { + for (DOMRpcIdentifier route : routes) { + if (!route.getContextReference().isEmpty()) { String type = route.getType().toString(); if (type.contains(name)) { StringBuilder builder = new StringBuilder(ROUTE_CONSTANT); - builder.append(route.getRoute() != null ? route.getRoute().toString() : NULL_CONSTANT) - .append(NAME_CONSTANT).append(type); + builder.append(route.getContextReference()).append(NAME_CONSTANT).append(type); rpcMap.put(builder.toString(), address); } }