Skip to content

Commit

Permalink
update close() of connection pool to idempotent (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 authored Oct 31, 2022
1 parent 68f18b9 commit f4431aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ public boolean init(List<HostAddress> addresses, NebulaPoolConfig config)
* close the pool, all connections will be closed
*/
public void close() {
checkClosed();
if (isClosed.get()) {
return;
}
isClosed.set(true);
this.loadBalancer.close();
this.objectPool.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public RoundRobinLoadBalancer(List<HostAddress> addresses, int timeout, SSLParam
}

public void close() {
schedule.shutdownNow();
if (!schedule.isShutdown()) {
schedule.shutdownNow();
}
}

@Override
Expand Down

0 comments on commit f4431aa

Please sign in to comment.