fix npe when connection is not established. (#6534)

This commit is contained in:
赵延 2021-08-10 09:31:40 +08:00 committed by GitHub
parent 4c1175acf0
commit 1a3c8cfb60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -455,7 +455,6 @@ public abstract class RpcClient implements Closeable {
rpcClientStatus.set(RpcClientStatus.SHUTDOWN);
LOGGER.info("Shutdown client event executor " + clientEventExecutor);
clientEventExecutor.shutdownNow();
LOGGER.info("Close current connection " + currentConnection.getConnectionId());
closeConnection(currentConnection);
}
@ -587,6 +586,7 @@ public abstract class RpcClient implements Closeable {
private void closeConnection(Connection connection) {
if (connection != null) {
LOGGER.info("Close current connection " + connection.getConnectionId());
connection.close();
eventLinkedBlockingQueue.add(new ConnectionEvent(ConnectionEvent.DISCONNECTED));
}