aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java2
-rw-r--r--config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java12
-rw-r--r--config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java11
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java6
-rw-r--r--jrt/src/com/yahoo/jrt/Transport.java2
5 files changed, 15 insertions, 18 deletions
diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java
index 10c840b2507..48d23e6ada5 100644
--- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java
+++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileDistributionAndUrlDownload.java
@@ -28,7 +28,7 @@ public class FileDistributionAndUrlDownload {
public FileDistributionAndUrlDownload(Supervisor supervisor, ConfigSourceSet source) {
fileDistributionRpcServer =
new FileDistributionRpcServer(supervisor,
- new FileDownloader(new JRTConnectionPool(source, "filedistribution-jrt-pool")));
+ new FileDownloader(new JRTConnectionPool(source, supervisor)));
urlDownloadRpcServer = new UrlDownloadRpcServer(supervisor);
cleanupExecutor.scheduleAtFixedRate(new CachedFilesMaintainer(), delay.toSeconds(), delay.toSeconds(), TimeUnit.SECONDS);
}
diff --git a/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java b/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java
index f4876826492..d7e21356ba2 100644
--- a/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java
+++ b/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java
@@ -37,19 +37,15 @@ public class JRTConnectionPool implements ConnectionPool {
private volatile JRTConnection currentConnection;
public JRTConnectionPool(ConfigSourceSet sourceSet) {
- this(sourceSet, "config-jrt-pool" + sourceSet.hashCode());
+ this(sourceSet, new Supervisor(new Transport("config-pool-" + sourceSet.hashCode())).setDropEmptyBuffers(true));
}
- public JRTConnectionPool(ConfigSourceSet sourceSet, String poolName) {
- this.poolName = poolName;
- supervisor = new Supervisor(new Transport(poolName + "-")).setDropEmptyBuffers(true);
+ public JRTConnectionPool(ConfigSourceSet sourceSet, Supervisor supervisor) {
+ this.supervisor = supervisor;
+ this.poolName = supervisor.transport().getName();
addSources(sourceSet);
}
- JRTConnectionPool(List<String> addresses) {
- this(new ConfigSourceSet(addresses));
- }
-
public void addSources(ConfigSourceSet sourceSet) {
this.sourceSet = sourceSet;
synchronized (connections) {
diff --git a/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java b/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java
index 5c0876a2649..43f9a87454d 100644
--- a/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java
+++ b/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java
@@ -5,7 +5,6 @@ import com.yahoo.config.subscription.ConfigSourceSet;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -27,7 +26,8 @@ import static org.junit.Assert.assertTrue;
* @author hmusum
*/
public class JRTConnectionPoolTest {
- private static final List<String> sources = new ArrayList<>((Arrays.asList("host0", "host1", "host2")));
+
+ private static final ConfigSourceSet sources = new ConfigSourceSet(List.of("host0", "host1", "host2"));
@Test
public void test_random_selection_of_source() {
@@ -57,7 +57,7 @@ public class JRTConnectionPoolTest {
public void testManySources() {
Map<String, Integer> timesUsed = new LinkedHashMap<>();
- List<String> twoSources = List.of("host0", "host1");
+ ConfigSourceSet twoSources = new ConfigSourceSet(List.of("host0", "host1"));
JRTConnectionPool sourcePool = new JRTConnectionPool(twoSources);
int count = 1000;
@@ -93,8 +93,7 @@ public class JRTConnectionPoolTest {
*/
@Test
public void updateSources() {
- List<String> twoSources = List.of("host0", "host1");
-
+ ConfigSourceSet twoSources = new ConfigSourceSet(List.of("host0", "host1"));
JRTConnectionPool sourcePool = new JRTConnectionPool(twoSources);
ConfigSourceSet sourcesBefore = sourcePool.getSourceSet();
@@ -130,7 +129,7 @@ public class JRTConnectionPoolTest {
@Test
public void testFailingSources() {
- List<String> sources = List.of("host0", "host1", "host2");
+ ConfigSourceSet sources = new ConfigSourceSet(List.of("host0", "host1"));
JRTConnectionPool connectionPool = new JRTConnectionPool(sources);
Connection firstConnection = connectionPool.getCurrent();
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java
index 04be936029f..2d39c5549cc 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java
@@ -50,7 +50,9 @@ public class FileDistributionUtil {
.collect(Collectors.toList());
return configServers.size() > 0
- ? new JRTConnectionPool(new ConfigSourceSet(configServers), "filedistribution-jrt-pool")
+ ? new JRTConnectionPool(new ConfigSourceSet(configServers),
+ new Supervisor(new Transport("filedistribution-pool"))
+ .setDropEmptyBuffers(true))
: emptyConnectionPool();
}
@@ -87,7 +89,7 @@ public class FileDistributionUtil {
public Supervisor getSupervisor() {
synchronized (this) {
if (supervisor == null) {
- supervisor = new Supervisor(new Transport("empty-connectionpool"));
+ supervisor = new Supervisor(new Transport("empty-connection-pool")).setDropEmptyBuffers(true);
}
}
return supervisor;
diff --git a/jrt/src/com/yahoo/jrt/Transport.java b/jrt/src/com/yahoo/jrt/Transport.java
index 9f7b71dfa68..0c8977f2c40 100644
--- a/jrt/src/com/yahoo/jrt/Transport.java
+++ b/jrt/src/com/yahoo/jrt/Transport.java
@@ -90,7 +90,7 @@ public class Transport {
boolean getTcpNoDelay() { return tcpNoDelay; }
int getEventsBeforeWakeup() { return eventsBeforeWakeup; }
- String getName() { return name; }
+ public String getName() { return name; }
/**
* Use the underlying CryptoEngine to create a CryptoSocket for