X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fremoterpc-routingtable%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnector%2Fremoterpc%2Fimpl%2FRoutingTableImpl.java;h=40c4c6b43625d9c99eecb786a1556762cbdc0085;hb=5bf8e609e5f7c2f69ea58a5d0e6d7a564457b2f1;hp=59292a174ed3ea4cee4f940e6841959631c1fb9d;hpb=7c8a9930f530bfff1da40a4165f7699b23584e17;p=controller.git diff --git a/opendaylight/md-sal/remoterpc-routingtable/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/impl/RoutingTableImpl.java b/opendaylight/md-sal/remoterpc-routingtable/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/impl/RoutingTableImpl.java index 59292a174e..40c4c6b436 100644 --- a/opendaylight/md-sal/remoterpc-routingtable/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/impl/RoutingTableImpl.java +++ b/opendaylight/md-sal/remoterpc-routingtable/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/impl/RoutingTableImpl.java @@ -72,24 +72,14 @@ public class RoutingTableImpl implements RoutingTable, ICacheUpdateA } // lets start a transaction clusterGlobalServices.tbegin(); - Set routes = new HashSet(); - routes.add(route); - routingTableCache.put(routeId, routes); + + routingTableCache.put(routeId, route); clusterGlobalServices.tcommit(); } else { throw new DuplicateRouteException(" There is already existing route " + existingRoute); } - } catch (NotSupportedException e) { - throw new RoutingTableException("Transaction error - while trying to create route id=" - + routeId + "with route" + route, e); - } catch (HeuristicRollbackException e) { - throw new RoutingTableException("Transaction error - while trying to create route id=" - + routeId + "with route" + route, e); - } catch (RollbackException e) { - throw new RoutingTableException("Transaction error - while trying to create route id=" - + routeId + "with route" + route, e); - } catch (HeuristicMixedException e) { + } catch (NotSupportedException|HeuristicRollbackException|RollbackException|HeuristicMixedException e) { throw new RoutingTableException("Transaction error - while trying to create route id=" + routeId + "with route" + route, e); } catch (javax.transaction.SystemException e) { @@ -116,16 +106,7 @@ public class RoutingTableImpl implements RoutingTable, ICacheUpdateA routingTableCache.remove(routeId); clusterGlobalServices.tcommit(); - } catch (NotSupportedException e) { - throw new RoutingTableException("Transaction error - while trying to remove route id=" - + routeId, e); - } catch (HeuristicRollbackException e) { - throw new RoutingTableException("Transaction error - while trying to remove route id=" - + routeId, e); - } catch (RollbackException e) { - throw new RoutingTableException("Transaction error - while trying to remove route id=" - + routeId, e); - } catch (HeuristicMixedException e) { + } catch (NotSupportedException|HeuristicRollbackException|RollbackException|HeuristicMixedException e) { throw new RoutingTableException("Transaction error - while trying to remove route id=" + routeId, e); } catch (javax.transaction.SystemException e) { @@ -139,10 +120,22 @@ public class RoutingTableImpl implements RoutingTable, ICacheUpdateA // Note: currently works for global routes only wherein there is just single // route Preconditions.checkNotNull(routeId, "getARoute: routeId cannot be null!"); - return (Set) routingTableCache.get(routeId); + R route = (R)routingTableCache.get(routeId); + Setroutes = null; + if(route !=null){ + routes = new HashSet(); + routes.add(route); + } + + return routes; } - @Override + @Override + public Set getAllRoutes() { + return routingTableCache.entrySet(); + } + + @Override public R getARoute(I routeId) { throw new UnsupportedOperationException("Not implemented yet!"); }