Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix javadocs and enable doclint
[controller.git]
/
opendaylight
/
md-sal
/
sal-remoterpc-connector
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
remote
/
rpc
/
registry
/
RoutingTable.java
diff --git
a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java
b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java
index d99faabfe45365fdc69dd7c45fa566f09e43f6e4..09a987f7e31d289c4f02656e6d187f641d23140e 100644
(file)
--- a/
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java
+++ b/
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java
@@
-10,62
+10,60
@@
package org.opendaylight.controller.remote.rpc.registry;
import akka.actor.ActorRef;
import akka.japi.Option;
import akka.japi.Pair;
import akka.actor.ActorRef;
import akka.japi.Option;
import akka.japi.Pair;
-import org.opendaylight.controller.remote.rpc.registry.gossip.Copier;
-import org.opendaylight.controller.sal.connector.api.RpcRouter;
-
import java.io.Serializable;
import java.io.Serializable;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
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 {
public class RoutingTable implements Copier<RoutingTable>, Serializable {
+ private static final long serialVersionUID = 5592610415175278760L;
- private Map<RpcRouter.RouteIdentifier<?, ?, ?>, Long> table = new HashMap<>();
+ private
final
Map<RpcRouter.RouteIdentifier<?, ?, ?>, Long> table = new HashMap<>();
private ActorRef router;
@Override
public RoutingTable copy() {
RoutingTable copy = new RoutingTable();
private ActorRef router;
@Override
public RoutingTable copy() {
RoutingTable copy = new RoutingTable();
- copy.
setTable(Collections.unmodifiableMap(table)
);
+ copy.
table.putAll(table
);
copy.setRouter(this.getRouter());
return copy;
}
copy.setRouter(this.getRouter());
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);
Long updatedTime = table.get(routeId);
- if (updatedTime == null || router == null)
+ if (updatedTime == null || router == null)
{
return Option.none();
return Option.none();
- else
+ } else {
return Option.option(new Pair<>(router, updatedTime));
return Option.option(new Pair<>(router, updatedTime));
+ }
+ }
+
+ public Set<RpcRouter.RouteIdentifier<?, ?, ?>> getRoutes() {
+ return table.keySet();
}
}
- public void addRoute(RpcRouter.RouteIdentifier<?,
?,?> routeId)
{
+ public void addRoute(RpcRouter.RouteIdentifier<?,
?, ?> routeId)
{
table.put(routeId, System.currentTimeMillis());
}
table.put(routeId, System.currentTimeMillis());
}
- public void removeRoute(RpcRouter.RouteIdentifier<?, ?, ?> routeId){
+ public void removeRoute(RpcRouter.RouteIdentifier<?, ?, ?> routeId)
{
table.remove(routeId);
}
table.remove(routeId);
}
- public
Boolean contains(RpcRouter.RouteIdentifier<?, ?, ?> routeId)
{
+ public
boolean contains(RpcRouter.RouteIdentifier<?, ?, ?> routeId)
{
return table.containsKey(routeId);
}
return table.containsKey(routeId);
}
- public
Boolean isEmpty()
{
+ public
boolean isEmpty()
{
return table.isEmpty();
}
return table.isEmpty();
}
- ///
- /// Getter, Setters
- ///
- //TODO: Remove public
- public Map<RpcRouter.RouteIdentifier<?, ?, ?>, Long> getTable() {
- return table;
- }
-
void setTable(Map<RpcRouter.RouteIdentifier<?, ?, ?>, Long> table
) {
-
this.table = table
;
+
public int size(
) {
+
return table.size()
;
}
public ActorRef getRouter() {
}
public ActorRef getRouter() {
@@
-78,9
+76,6
@@
public class RoutingTable implements Copier<RoutingTable>, Serializable {
@Override
public String toString() {
@Override
public String toString() {
- return "RoutingTable{" +
- "table=" + table +
- ", router=" + router +
- '}';
+ return "RoutingTable{" + "table=" + table + ", router=" + router + '}';
}
}
}
}