summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2017-11-23 21:55:41 +0100
committerGitHub <noreply@github.com>2017-11-23 21:55:41 +0100
commit480f78725c6b59861105fe138686120ea0a60851 (patch)
tree207468e06caa1c4240c9599616cf7b203f293130 /configserver
parente603b021de8b94ba2a70799b7f70da439bcc42b5 (diff)
Revert "Hmusum/choose new connection if file reference not found"
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java31
-rw-r--r--configserver/src/main/resources/configserver-app/services.xml1
2 files changed, 5 insertions, 27 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
index 3561a5cba9a..9dc94c9fe93 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java
@@ -2,29 +2,24 @@
package com.yahoo.vespa.config.server.filedistribution;
import com.google.inject.Inject;
-import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.config.FileReference;
import com.yahoo.config.model.api.FileDistribution;
import com.yahoo.config.subscription.ConfigSourceSet;
import com.yahoo.io.IOUtils;
-import com.yahoo.net.HostName;
import com.yahoo.vespa.config.JRTConnectionPool;
-import com.yahoo.vespa.config.server.ConfigServerSpec;
import com.yahoo.vespa.filedistribution.FileDownloader;
import java.io.File;
import java.io.IOException;
-import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
-import java.util.stream.Collectors;
public class FileServer {
private static final Logger log = Logger.getLogger(FileServer.class.getName());
private final FileDirectory root;
private final ExecutorService executor;
- private final FileDownloader downloader;
+ private final FileDownloader downloader = new FileDownloader(new JRTConnectionPool(ConfigSourceSet.createDefault()));
public static class ReplayStatus {
private final int code;
@@ -43,21 +38,15 @@ public class FileServer {
}
@Inject
- public FileServer(ConfigserverConfig configserverConfig) {
- this(createConnectionPool(ConfigServerSpec.fromConfig(configserverConfig)), FileDistribution.getDefaultFileDBPath());
+ public FileServer() {
+ this(FileDistribution.getDefaultFileDBPath());
}
- // For testing only
public FileServer(File rootDir) {
- this(new JRTConnectionPool(new ConfigSourceSet("tcp/localhost:19090")), rootDir);
+ this(rootDir, Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
}
- public FileServer(JRTConnectionPool jrtConnectionPool, File rootDir) {
- this(jrtConnectionPool, rootDir, Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
- }
-
- public FileServer(JRTConnectionPool jrtConnectionPool, File rootDir, ExecutorService executor) {
- this.downloader = new FileDownloader(jrtConnectionPool);
+ public FileServer(File rootDir, ExecutorService executor) {
this.root = new FileDirectory(rootDir);
this.executor = executor;
}
@@ -105,14 +94,4 @@ public class FileServer {
public void download(FileReference fileReference) {
downloader.getFile(fileReference);
}
-
- // Connection pool with all config servers except this one
- private static JRTConnectionPool createConnectionPool(List<com.yahoo.config.model.api.ConfigServerSpec> configServerSpecs) {
- return new JRTConnectionPool(
- new ConfigSourceSet(configServerSpecs
- .stream()
- .filter(spec -> !spec.getHostName().equals(HostName.getLocalhost()))
- .map(spec -> "tcp/" + spec.getHostName() + ":" + spec.getConfigServerPort())
- .collect(Collectors.toList())));
- }
}
diff --git a/configserver/src/main/resources/configserver-app/services.xml b/configserver/src/main/resources/configserver-app/services.xml
index fbab854ae9e..635ce07e727 100644
--- a/configserver/src/main/resources/configserver-app/services.xml
+++ b/configserver/src/main/resources/configserver-app/services.xml
@@ -34,7 +34,6 @@
<component id="com.yahoo.config.provision.Zone" bundle="config-provisioning" />
<component id="com.yahoo.vespa.config.server.application.ApplicationConvergenceChecker" bundle="configserver" />
<component id="com.yahoo.vespa.config.server.application.HttpProxy" bundle="configserver" />
- <component id="com.yahoo.vespa.config.server.filedistribution.FileServer" bundle="configserver" />
<component id="com.yahoo.vespa.serviceview.ConfigServerLocation" bundle="configserver" />