X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnector%2Fremoterpc%2FRoutingTableProvider.java;h=d960303fcf4b45c5ec5ac7d35ccff04f2fee4a3b;hp=cfdf98638d450830f65b04772a9ea14111430a1c;hb=ed62b66118000e74ef3ddbf53f265ae02e7c8912;hpb=711bd1804e4b3362337be7ed0955f94e234dc7b3 diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java index cfdf98638d..d960303fcf 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java @@ -1,6 +1,16 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + package org.opendaylight.controller.sal.connector.remoterpc; +import org.opendaylight.controller.sal.connector.api.RpcRouter; import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable; +import org.opendaylight.controller.sal.connector.remoterpc.impl.RoutingTableImpl; import org.osgi.framework.BundleContext; import org.osgi.util.tracker.ServiceTracker; @@ -10,18 +20,32 @@ public class RoutingTableProvider implements AutoCloseable { @SuppressWarnings("rawtypes") final ServiceTracker tracker; - - - public RoutingTableProvider(BundleContext ctx) { + + private RoutingTableImpl routingTableImpl = null; + + //final private RouteChangeListener routeChangeListener; + + + public RoutingTableProvider(BundleContext ctx){//,RouteChangeListener rcl) { @SuppressWarnings("rawtypes") ServiceTracker rawTracker = new ServiceTracker<>(ctx, RoutingTable.class, null); tracker = rawTracker; tracker.open(); + + //routeChangeListener = rcl; } - - public Optional> getRoutingTable() { + + public Optional, String>> getRoutingTable() { @SuppressWarnings("unchecked") - RoutingTable tracked = tracker.getService(); + RoutingTable, String> tracked = tracker.getService(); + + if(tracked instanceof RoutingTableImpl){ + if(routingTableImpl != tracked){ + routingTableImpl= (RoutingTableImpl)tracked; + //routingTableImpl.setRouteChangeListener(routeChangeListener); + } + } + return Optional.fromNullable(tracked); }