From 84fc775328cb28bb5a01edfe23f5257b51d4df9b Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Sun, 28 Nov 2021 19:32:27 +0100 Subject: Simplify --- .../filedistribution/FileDistributionFactory.java | 2 +- .../filedistribution/FileDistributionImpl.java | 25 ++++++++-------------- 2 files changed, 10 insertions(+), 17 deletions(-) (limited to 'configserver/src/main/java/com') diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionFactory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionFactory.java index 3e3c7066927..1027cc6a237 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionFactory.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionFactory.java @@ -32,7 +32,7 @@ public class FileDistributionFactory implements AutoCloseable { } public FileDistribution createFileDistribution() { - return new FileDistributionImpl(getFileReferencesDir(), supervisor); + return new FileDistributionImpl(supervisor); } public AddFileInterface createFileManager(File applicationDir) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java index 605f5924e68..abb8a3e8487 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java @@ -10,7 +10,6 @@ import com.yahoo.jrt.StringArray; import com.yahoo.jrt.Supervisor; import com.yahoo.jrt.Target; -import java.io.File; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -24,26 +23,21 @@ public class FileDistributionImpl implements FileDistribution, RequestWaiter { private final static double rpcTimeout = 1.0; private final Supervisor supervisor; - private final File fileReferencesDir; - public FileDistributionImpl(File fileReferencesDir, Supervisor supervisor) { - this.fileReferencesDir = fileReferencesDir; + public FileDistributionImpl(Supervisor supervisor) { this.supervisor = supervisor; } + /** + * Notifies client which file references it should start downloading. It's OK if the call does not succeed, + * as this is just a hint to the client to start downloading. Currently the only client is the config server + * + * @param hostName host which should be notified about file references to download + * @param port port which should be used when notifying + * @param fileReferences set of file references to start downloading + */ @Override public void startDownload(String hostName, int port, Set fileReferences) { - startDownloadingFileReferences(hostName, port, fileReferences); - } - - @Override - public File getFileReferencesDir() { - return fileReferencesDir; - } - - // Notifies client which file references it should start downloading. It's OK if the call does not succeed, - // as this is just a hint to the client to start downloading. Currently the only client is the config server - private void startDownloadingFileReferences(String hostName, int port, Set fileReferences) { Target target = supervisor.connect(new Spec(hostName, port)); Request request = new Request("filedistribution.setFileReferencesToDownload"); request.setContext(target); @@ -52,7 +46,6 @@ public class FileDistributionImpl implements FileDistribution, RequestWaiter { target.invokeAsync(request, rpcTimeout, this); } - @Override public void handleRequestDone(Request req) { Target target = (Target) req.getContext(); -- cgit v1.2.3