summaryrefslogtreecommitdiffstats
path: root/fileacquirer
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-11-08 14:56:40 +0100
committerHarald Musum <musum@yahooinc.com>2023-11-08 14:56:40 +0100
commite0d807f82338ea2278592d7a2079dc85c286135f (patch)
tree57fc1989a6d167087051f2420516a20449b5178a /fileacquirer
parente7b517e5705538cd90a72920c3edb0d36abb274e (diff)
Stop subscribing to config that is static
File acquirer will always use localhost:19090 for getting files now, remove need for subscribing to qr config. Will also remove restart log message when e.g. moving logserver to a new node
Diffstat (limited to 'fileacquirer')
-rw-r--r--fileacquirer/abi-spec.json2
-rw-r--r--fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerFactory.java4
-rw-r--r--fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java29
3 files changed, 12 insertions, 23 deletions
diff --git a/fileacquirer/abi-spec.json b/fileacquirer/abi-spec.json
index 63e3ba71f2d..caec5f8629c 100644
--- a/fileacquirer/abi-spec.json
+++ b/fileacquirer/abi-spec.json
@@ -21,7 +21,7 @@
],
"methods" : [
"public void <init>()",
- "public static com.yahoo.filedistribution.fileacquirer.FileAcquirer create(java.lang.String)"
+ "public static com.yahoo.filedistribution.fileacquirer.FileAcquirer create()"
],
"fields" : [ ]
},
diff --git a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerFactory.java b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerFactory.java
index 24744728f78..8de5f87d8b0 100644
--- a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerFactory.java
+++ b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerFactory.java
@@ -9,8 +9,8 @@ package com.yahoo.filedistribution.fileacquirer;
*/
public class FileAcquirerFactory {
- public static FileAcquirer create(String configId) {
- return new FileAcquirerImpl(configId);
+ public static FileAcquirer create() {
+ return new FileAcquirerImpl();
}
}
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 b3c4382c397..ddddcfc2170 100644
--- a/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java
+++ b/fileacquirer/src/main/java/com/yahoo/filedistribution/fileacquirer/FileAcquirerImpl.java
@@ -1,9 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.filedistribution.fileacquirer;
-import com.yahoo.cloud.config.filedistribution.FiledistributorrpcConfig;
import com.yahoo.config.FileReference;
-import com.yahoo.config.subscription.ConfigSubscriber;
import com.yahoo.jrt.ErrorCode;
import com.yahoo.jrt.Request;
import com.yahoo.jrt.Spec;
@@ -12,6 +10,7 @@ import com.yahoo.jrt.Supervisor;
import com.yahoo.jrt.Target;
import com.yahoo.jrt.Transport;
import com.yahoo.vespa.config.FileReferenceDoesNotExistException;
+
import java.io.File;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
@@ -20,6 +19,8 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
+import static com.yahoo.net.HostName.getLocalhost;
+
/**
* Retrieves the path to a file or directory on the local file system
* that has been transferred with the vespa file distribution
@@ -43,15 +44,15 @@ class FileAcquirerImpl implements FileAcquirer {
private final Supervisor supervisor = new Supervisor(new Transport("fileaquirer"));
- private final ConfigSubscriber configSubscriber;
+ private class Connection {
- private class Connection implements ConfigSubscriber.SingleSubscriber<FiledistributorrpcConfig> {
- private final Lock targetLock = new ReentrantLock();
- private Target target;
+ private static final int configProxyRpcPort = 19090;
- private volatile Spec spec;
+ private final Lock targetLock = new ReentrantLock();
+ private final Spec spec = new Spec(getLocalhost(), configProxyRpcPort);
private long pauseTime = 0; //milliseconds
+ private Target target;
private long nextLogTime = 0;
private long logCount = 0;
@@ -85,7 +86,7 @@ class FileAcquirerImpl implements FileAcquirer {
private void logWarning() {
if (logCount == 0 || System.currentTimeMillis() > nextLogTime ) {
- log.warning("Could not connect to the config proxy '" + spec.toString() + "'" + " - " + this + "@" + System.identityHashCode(this));
+ log.warning("Could not connect to the config proxy '" + spec + "'" + " - " + this + "@" + System.identityHashCode(this));
nextLogTime = System.currentTimeMillis() +
Math.min(TimeUnit.DAYS.toMillis(1),
@@ -94,11 +95,6 @@ class FileAcquirerImpl implements FileAcquirer {
}
}
- @Override
- public void configure(FiledistributorrpcConfig filedistributorrpcConfig) {
- spec = new Spec(filedistributorrpcConfig.connectionspec());
- }
-
public Target getTarget(Timer timer) throws InterruptedException {
TimeUnit unit = TimeUnit.MILLISECONDS;
@@ -122,17 +118,10 @@ class FileAcquirerImpl implements FileAcquirer {
};
}
- public FileAcquirerImpl(String configId) {
- configSubscriber = new ConfigSubscriber();
- configSubscriber.subscribe(connection, FiledistributorrpcConfig.class, configId);
- }
-
public void shutdown() {
- configSubscriber.close();
supervisor.transport().shutdown().join();
}
-
/**
* Returns the path to a file or directory corresponding to the
* given file reference. File references are produced by the