You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2021/10/04 21:08:37 UTC
[GitHub] [tinkerpop] xiazcy commented on a change in pull request #1476: TINKERPOP-2569: Reconnect if java driver fails to initialize
xiazcy commented on a change in pull request #1476:
URL: https://github.com/apache/tinkerpop/pull/1476#discussion_r721719083
##########
File path: gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
##########
@@ -526,18 +527,24 @@ protected void initializeImplementation() {
try {
CompletableFuture.allOf(cluster.allHosts().stream()
- .map(host -> CompletableFuture.runAsync(() -> initializeConnectionSetupForHost.accept(host), hostExecutor))
- .toArray(CompletableFuture[]::new))
+ .map(host -> CompletableFuture.runAsync(() -> initializeConnectionSetupForHost.accept(host), hostExecutor))
+ .toArray(CompletableFuture[]::new))
.join();
} catch (CompletionException ex) {
- Throwable cause;
- Throwable result = ex;
- if (null != (cause = ex.getCause())) {
- result = cause;
- }
+ logger.error("", (ex.getCause() == null) ? ex : ex.getCause());
+ }
- logger.error("", result);
- } finally {
+ // throw an error if there is no host available after initializing connection pool.
+ if (cluster.availableHosts().isEmpty()) {
+ throw new NoHostAvailableException();
Review comment:
I've missed this, thanks! I've put it back in the finally clause.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org