diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-08-03 11:37:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 11:37:14 +0200 |
commit | cb7bacfafde63f3464e962d21b4619741ae7f942 (patch) | |
tree | d84e6b817ea063bdf2407b29e05ac324aac35dad | |
parent | de3cf2c660746cfb8c804cc80ffbb5556fe3b23f (diff) | |
parent | 28c7d0d3c34c25de7b583f8ffcbe9f7cff89a502 (diff) |
Merge pull request #13962 from vespa-engine/balder/do-not-produce-transports-on-the-fly
Create one Supervisor instead of a new one on every request.
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java | 18 |
1 files changed, 16 insertions, 2 deletions
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 de3a2b47233..305bc71e66a 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 @@ -60,9 +60,16 @@ public class FileDistributionUtil { } private static class EmptyConnectionPool implements ConnectionPool { + private Supervisor supervisor; @Override - public void close() {} + public void close() { + synchronized (this) { + if (supervisor != null) { + supervisor.transport().shutdown().join(); + } + } + } @Override public void setError(Connection connection, int i) {} @@ -77,7 +84,14 @@ public class FileDistributionUtil { public int getSize() { return 0; } @Override - public Supervisor getSupervisor() { return new Supervisor(new Transport()); } + public Supervisor getSupervisor() { + synchronized (this) { + if (supervisor == null) { + supervisor = new Supervisor(new Transport()); + } + } + return supervisor; + } } } |