+ public synchronized void reconnect() {
+ if (this.retryTimer == 0) {
+ LOG.debug("Retry timer value is 0. Reconnection will not be attempted");
+ this.setFailure(this.pending.cause());
+ return;
+ }
+
+ final BGPProtocolSessionPromise lock = this;
+ final EventLoop loop = this.pending.channel().eventLoop();
+ loop.schedule(new Runnable() {
+ @Override
+ public void run() {
+ LOG.debug("Attempting to connect to {}", BGPProtocolSessionPromise.this.address);
+ final ChannelFuture reconnectFuture = BGPProtocolSessionPromise.this.bootstrap.connect();
+ reconnectFuture.addListener(new BootstrapConnectListener(lock));
+ BGPProtocolSessionPromise.this.pending = reconnectFuture;
+ }
+ }, this.retryTimer, TimeUnit.SECONDS);
+ LOG.debug("Next reconnection attempt in {}s", this.retryTimer);
+ }
+