Skip to content

Commit

Permalink
Fix bug for bolt connection manager. (sofastack#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
leizhiyuan authored Jun 3, 2019
1 parent 8c8bb1a commit 9c1f3d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ public ClientTransport getClientTransport(ClientTransportConfig config) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Multiple threads init ClientTransport with same key:" + key);
}
transport.destroy(); //如果同时有人插入,则使用第一个
transport = oldTransport;
//only is not equals ,we can close
if (oldTransport != transport) {
transport.destroy(); //如果同时有人插入,则使用第一个
transport = oldTransport;
}
}
}
AtomicInteger counter = transportRefCounter.get(transport);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected Url convertProviderToUrl(ClientTransportConfig transportConfig, Provid
public void connect() {
if (connection != null) {
if (!connection.isFine()) {
connection.close();
RPC_CLIENT.closeStandaloneConnection(connection);
connection = null;
}
}
Expand Down Expand Up @@ -166,7 +166,7 @@ public void disconnect() {
}
}
connection = null;
RPC_CLIENT.closeConnection(url);
RPC_CLIENT.closeStandaloneConnection(connection);
} catch (Exception e) {
throw new SofaRpcRuntimeException("", e);
}
Expand Down

0 comments on commit 9c1f3d1

Please sign in to comment.