Remove unused BGP OpenConfig provider implementation
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPSessionImpl.java
index fcb38fab03e94bd996d70870fd7d72cc8420c929..2dad1f7475915868a68d59f16dadf1a646bfdfbe 100644 (file)
@@ -226,8 +226,8 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
     public synchronized void close() {
         if (this.state != State.IDLE) {
             this.writeAndFlush(new NotifyBuilder().setErrorCode(BGPError.CEASE.getCode()).setErrorSubcode(BGPError.CEASE.getSubcode()).build());
+            this.closeWithoutMessage();
         }
-        this.closeWithoutMessage();
     }
 
     /**
@@ -314,6 +314,9 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
     }
 
     private synchronized void closeWithoutMessage() {
+        if (this.state == State.IDLE) {
+            return;
+        }
         LOG.info("Closing session: {}", this);
         removePeerSession();
         this.channel.close().addListener(new ChannelFutureListener() {
@@ -449,16 +452,6 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
         return this.channel != null && this.channel.isWritable();
     }
 
-    void schedule(final Runnable task) {
-        Preconditions.checkState(this.channel != null);
-        this.channel.eventLoop().submit(task);
-    }
-
-    @VisibleForTesting
-    protected synchronized void setLastMessageSentAt(final long lastMessageSentAt) {
-        this.lastMessageSentAt = lastMessageSentAt;
-    }
-
     @Override
     public synchronized BgpSessionState getBgpSessionState() {
         return this.sessionStats.getBgpSessionState();