BUG-6937: Add ReachableMember case to Gossiper
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / registry / RoutingTable.java
index 52b1106c873872609e4300abe52d558ee89a6011..09a987f7e31d289c4f02656e6d187f641d23140e 100644 (file)
@@ -13,11 +13,12 @@ import akka.japi.Pair;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 import org.opendaylight.controller.remote.rpc.registry.gossip.Copier;
 import org.opendaylight.controller.sal.connector.api.RpcRouter;
 
 public class RoutingTable implements Copier<RoutingTable>, Serializable {
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 5592610415175278760L;
 
     private final Map<RpcRouter.RouteIdentifier<?, ?, ?>, Long> table = new HashMap<>();
     private ActorRef router;
@@ -31,7 +32,7 @@ public class RoutingTable implements Copier<RoutingTable>, Serializable {
         return copy;
     }
 
-    public Option<Pair<ActorRef, Long>> getRouterFor(RpcRouter.RouteIdentifier<?, ?, ?> routeId){
+    public Option<Pair<ActorRef, Long>> getRouterFor(RpcRouter.RouteIdentifier<?, ?, ?> routeId) {
         Long updatedTime = table.get(routeId);
 
         if (updatedTime == null || router == null) {
@@ -41,19 +42,23 @@ public class RoutingTable implements Copier<RoutingTable>, Serializable {
         }
     }
 
-    public void addRoute(RpcRouter.RouteIdentifier<?,?,?> routeId){
+    public Set<RpcRouter.RouteIdentifier<?, ?, ?>> getRoutes() {
+        return table.keySet();
+    }
+
+    public void addRoute(RpcRouter.RouteIdentifier<?, ?, ?> routeId) {
         table.put(routeId, System.currentTimeMillis());
     }
 
-    public void removeRoute(RpcRouter.RouteIdentifier<?, ?, ?> routeId){
+    public void removeRoute(RpcRouter.RouteIdentifier<?, ?, ?> routeId) {
         table.remove(routeId);
     }
 
-    public boolean contains(RpcRouter.RouteIdentifier<?, ?, ?> routeId){
+    public boolean contains(RpcRouter.RouteIdentifier<?, ?, ?> routeId) {
         return table.containsKey(routeId);
     }
 
-    public boolean isEmpty(){
+    public boolean isEmpty() {
         return table.isEmpty();
     }
 
@@ -71,9 +76,6 @@ public class RoutingTable implements Copier<RoutingTable>, Serializable {
 
     @Override
     public String toString() {
-        return "RoutingTable{" +
-                "table=" + table +
-                ", router=" + router +
-                '}';
+        return "RoutingTable{" + "table=" + table + ", router=" + router + '}';
     }
 }