fix : The client and server are connected synchronously

pull/1006/head
pizihao 3 years ago
parent 1910ddc8a6
commit 75176164c7

@ -108,7 +108,7 @@ public class NettyClientConnection implements ClientConnection {
} }
@Override @Override
public void close() { public synchronized void close() {
if (this.channel == null) { if (this.channel == null) {
return; return;
} }

@ -105,12 +105,13 @@ public class NettyServerConnection extends AbstractNettyHandlerManager implement
} }
@Override @Override
public void close() { public synchronized void close() {
if (port == null) { if (port == null) {
return; return;
} }
leader.shutdownGracefully(); this.leader.shutdownGracefully();
worker.shutdownGracefully(); this.worker.shutdownGracefully();
this.channel.close();
this.future.channel().close(); this.future.channel().close();
log.info("The server is shut down and no more requests are received. The release port is {}", port.getPort()); log.info("The server is shut down and no more requests are received. The release port is {}", port.getPort());
} }
@ -146,4 +147,5 @@ public class NettyServerConnection extends AbstractNettyHandlerManager implement
super.addFirst(handler); super.addFirst(handler);
return this; return this;
} }
} }

Loading…
Cancel
Save