X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=bgp%2Frib-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FApplicationPeer.java;fp=bgp%2Frib-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FApplicationPeer.java;h=14bcb2b0f886928e8f87d20dd2207c8f44d05e74;hb=d2849ff56cf15906a89cce26df40275213d1787c;hp=c1fb365ef798055309e1d830a568f8c80c5d2ce0;hpb=5e1eb98f43719f020e978e954474be0b03d7a43d;p=bgpcep.git diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java index c1fb365ef7..14bcb2b0f8 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java @@ -10,6 +10,8 @@ package org.opendaylight.protocol.bgp.rib.impl; import com.google.common.base.Preconditions; import com.google.common.base.Verify; import com.google.common.net.InetAddresses; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -66,7 +68,7 @@ import org.slf4j.LoggerFactory; * For purposed of import policies such as Best Path Selection, application * peer needs to have a BGP-ID that is configurable. */ -public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol.bgp.rib.spi.Peer, ClusteredDOMDataTreeChangeListener, TransactionChainListener { +public class ApplicationPeer implements org.opendaylight.protocol.bgp.rib.spi.Peer, ClusteredDOMDataTreeChangeListener, TransactionChainListener { private static final Logger LOG = LoggerFactory.getLogger(ApplicationPeer.class); @@ -248,8 +250,9 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol return this.name; } + // FIXME ListenableFuture should be used once closeServiceInstance uses wildcard too @Override - public synchronized void close() { + public synchronized ListenableFuture close() { if (this.registration != null) { this.registration.close(); this.registration = null; @@ -257,8 +260,11 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol if (this.effectiveRibInWriter != null) { this.effectiveRibInWriter.close(); } + final ListenableFuture future; if (this.adjRibInWriter != null) { - this.adjRibInWriter.removePeer(); + future = this.adjRibInWriter.removePeer(); + }else { + future = Futures.immediateFuture(null); } if (this.chain != null) { this.chain.close(); @@ -271,6 +277,7 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol if (this.moduleTracker != null) { this.moduleTracker.onInstanceClose(); } + return future; } @Override