Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not close connection by url when connection closed. #498

Merged
merged 6 commits into from Feb 20, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -126,7 +126,7 @@ public Connection getConnection(RpcClient rpcClient, ClientTransportConfig trans
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Multiple threads init ClientTransport with same key:" + url);
}
connection.close(); //如果同时有人插入,则使用第一个
rpcClient.closeStandaloneConnection(connection); //如果同时有人插入,则使用第一个
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closeStandaloneConnection 对应的是 RpcClient#createStandaloneConnection 创建出的连接。我们这里用的是 RpcClient#getConnection 这个应该是自带 connectionManager 的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,自带,我们这个是为了修复那个bug。

connection = oldConnection;
} else {

Expand Down Expand Up @@ -188,7 +188,7 @@ public void closeConnection(RpcClient rpcClient, ClientTransportConfig transport
}
}
if (needDestroy) {
rpcClient.closeConnection(url);
rpcClient.closeStandaloneConnection(connection);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

}
}
}