diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-06-15 08:46:59 +0200 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2021-06-15 08:46:59 +0200 |
commit | 109dd89384b9db3c4bc4bc2a6e325456bc6f853b (patch) | |
tree | d7fe4dcb2b66f24a63386aa8cd1b43dc6418d0b2 /config/src | |
parent | 5667784f2fca043d79863160946dce85832890b6 (diff) |
Add constructor for naming JRTConnectionPool
Diffstat (limited to 'config/src')
-rw-r--r-- | config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java | 12 |
1 files changed, 9 insertions, 3 deletions
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 26eafb67c1b..e5bcb56ccb3 100644 --- a/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java +++ b/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java @@ -29,6 +29,7 @@ public class JRTConnectionPool implements ConnectionPool { private final Supervisor supervisor; private final Map<String, JRTConnection> connections = new LinkedHashMap<>(); + private final String poolName; // The config sources used by this connection pool. private ConfigSourceSet sourceSet = null; @@ -37,11 +38,16 @@ public class JRTConnectionPool implements ConnectionPool { private volatile JRTConnection currentConnection; public JRTConnectionPool(ConfigSourceSet sourceSet) { - supervisor = new Supervisor(new Transport("config-jrtpool-" + sourceSet.hashCode())).useSmallBuffers(); + this(sourceSet, "config-jrt-pool-" + sourceSet.hashCode()); + } + + public JRTConnectionPool(ConfigSourceSet sourceSet, String poolName) { + this.poolName = poolName; + supervisor = new Supervisor(new Transport(poolName)).useSmallBuffers(); addSources(sourceSet); } - public JRTConnectionPool(List<String> addresses) { + JRTConnectionPool(List<String> addresses) { this(new ConfigSourceSet(addresses)); } @@ -131,7 +137,7 @@ public class JRTConnectionPool implements ConnectionPool { } public String toString() { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(poolName + ": "); synchronized (connections) { for (JRTConnection conn : connections.values()) { sb.append(conn.toString()); |