yuqi1129 commented on a change in pull request #2662:
URL: https://github.com/apache/iotdb/pull/2662#discussion_r583643342
##########
File path:
cluster/src/main/java/org/apache/iotdb/cluster/client/async/AsyncClientPool.java
##########
@@ -81,19 +82,19 @@ public AsyncClient getClient(Node node, boolean
activatedOnly) throws IOExceptio
AsyncClient client;
// As clientCaches is ConcurrentHashMap, computeIfAbsent is thread safety.
- Deque<AsyncClient> clientStack =
+ Deque<AsyncClient> clientDeque =
clientCaches.computeIfAbsent(clusterNode, n -> new ArrayDeque<>());
synchronized (this) {
- if (clientStack.isEmpty()) {
+ if (clientDeque.isEmpty()) {
int nodeClientNum = nodeClientNumMap.getOrDefault(clusterNode, 0);
if (nodeClientNum >= maxConnectionForEachNode) {
- client = waitForClient(clientStack, clusterNode, nodeClientNum);
+ client = waitForClient(clientDeque, clusterNode);
} else {
nodeClientNumMap.put(clusterNode, nodeClientNum + 1);
client = asyncClientFactory.getAsyncClient(clusterNode, this);
}
} else {
- client = clientStack.pop();
+ client = clientDeque.getFirst();
Review comment:
Sorry, this is a mistake i make here, `getFirst()` will not remove
element from queue
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]