use of org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RemoteRpcRegistryMXBeanImpl method getRpcMemberMapByName.
/**
* Search if the routing table route type contains name.
*/
private static Map<String, String> getRpcMemberMapByName(final RoutingTable table, final String name, final String address) {
Set<DOMRpcIdentifier> routes = table.getRoutes();
Map<String, String> rpcMap = new HashMap<>(routes.size());
for (DOMRpcIdentifier route : routes) {
if (!route.getContextReference().isEmpty()) {
String type = route.getType().toString();
if (type.contains(name)) {
rpcMap.put(ROUTE_CONSTANT + route.getContextReference() + NAME_CONSTANT + type, address);
}
}
}
return rpcMap;
}
use of org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier in project controller by opendaylight.
the class RpcRegistry method onBucketsUpdated.
@Override
protected void onBucketsUpdated(final Map<Address, Bucket<RoutingTable>> buckets) {
final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = new HashMap<>(buckets.size());
for (Entry<Address, Bucket<RoutingTable>> e : buckets.entrySet()) {
final RoutingTable table = e.getValue().getData();
final Collection<DOMRpcIdentifier> rpcs = table.getRoutes();
endpoints.put(e.getKey(), rpcs.isEmpty() ? Optional.empty() : Optional.of(new RemoteRpcEndpoint(table.getRpcInvoker(), rpcs)));
}
if (!endpoints.isEmpty()) {
rpcRegistrar.tell(new UpdateRemoteEndpoints(endpoints), ActorRef.noSender());
}
}
Aggregations