close effRibInWriter properly
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPPeer.java
index 4f4fb0a2f17901966413a8c9d03361bb956b4712..fd568c63c3a89477ed6179d1f5dc9977f647a8d6 100644 (file)
@@ -415,6 +415,7 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
             }
             this.ribWriter.clearTables(Sets.difference(this.tables, forwardingTables));
             if (restartingLocally) {
+                this.effRibInWriter.close();
                 this.peerRestartStopwatch = Stopwatch.createStarted();
                 handleSelectionReferralTimer();
                 this.missingEOT.addAll(this.tables);
@@ -507,9 +508,6 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
         if (!isRestartingGracefully()) {
             future = terminateConnection();
         } else {
-            if (isLocalRestarting()){
-                this.effRibInWriter.close();
-            }
             final Set<TablesKey> gracefulTables = getGracefulTables();
             this.ribWriter.storeStaleRoutes(gracefulTables);
             future = this.ribWriter.clearTables(Sets.difference(this.tables, gracefulTables));