aboutsummaryrefslogtreecommitdiffstats
path: root/fileacquirer
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2019-02-25 14:47:59 +0100
committerHarald Musum <musum@verizonmedia.com>2019-02-25 14:47:59 +0100
commit646251bc259c32df7fc6aca48b9a9bb88c4f16cb (patch)
tree4caa0975483902d8d1d114aa4c5755e2eed3de7f /fileacquirer
parent3148c6dc8e5d7911ccf0bbb533edaa4ceb3b7c5d (diff)
Use connect instead of connectSync
When using TLS the handshake may not be finished when connectSync returns, which might lead to unpredicatable and confusing behavior, use connect and ping to check for RPC connection being up instead.
Diffstat (limited to 'fileacquirer')
-rw-r--r--fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java
index ab0f7521e7e..bd4401d3cab 100644
--- a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java
+++ b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java
@@ -52,14 +52,18 @@ class FileAcquirerImpl implements FileAcquirer {
private void connect(Timer timer) throws InterruptedException {
while (timer.isTimeLeft()) {
pause();
- target = supervisor.connectSync(spec);
- if (target.isValid()) {
+ target = supervisor.connect(spec);
+ // ping to check if connection is working
+ Request request = new Request("frt.rpc.ping");
+ target.invokeSync(request, 5.0);
+ if (request.isError()) {
+ logWarning();
+ target.close();
+ } else {
log.log(LogLevel.DEBUG, "Successfully connected to '" + spec + "', this = " + System.identityHashCode(this));
pauseTime = 0;
logCount = 0;
return;
- } else {
- logWarning();
}
}
}