diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2022-03-09 12:12:01 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2022-03-09 12:12:01 +0100 |
commit | ac449aa8d3e4b22a4ae742a5dfa15e59fb641abf (patch) | |
tree | 9c7ce7af8e8dfe04348dbceb659ccb6b9b43c30a /zkfacade/src | |
parent | 7743992d1dd55b635a297ad97546d4fbfd5ce23f (diff) |
Close Curator instances
Diffstat (limited to 'zkfacade/src')
-rw-r--r-- | zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java b/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java index d226cfcd43e..2b5395773ee 100644 --- a/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java +++ b/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java @@ -3,6 +3,7 @@ package com.yahoo.vespa.curator; import com.google.inject.Inject; import com.yahoo.cloud.config.CuratorConfig; +import com.yahoo.component.AbstractComponent; import com.yahoo.path.Path; import com.yahoo.vespa.curator.api.VespaCurator; import com.yahoo.vespa.curator.recipes.CuratorCounter; @@ -49,7 +50,7 @@ import java.util.logging.Logger; * @author vegardh * @author bratseth */ -public class Curator implements VespaCurator, AutoCloseable { +public class Curator extends AbstractComponent implements VespaCurator, AutoCloseable { private static final Logger LOG = Logger.getLogger(Curator.class.getName()); private static final File ZK_CLIENT_CONFIG_FILE = new File(Defaults.getDefaults().underVespaHome("conf/zookeeper/zookeeper-client.cfg")); @@ -82,7 +83,6 @@ public class Curator implements VespaCurator, AutoCloseable { } @Inject - // TODO jonmv: Use a Provider for this, due to required shutdown. public Curator(CuratorConfig curatorConfig, @SuppressWarnings("unused") VespaZooKeeperServer server) { // Depends on ZooKeeperServer to make sure it is started first this(ConnectionSpec.create(curatorConfig.server(), @@ -316,6 +316,11 @@ public class Curator implements VespaCurator, AutoCloseable { curatorFramework.close(); } + @Override + public void deconstruct() { + close(); + } + /** * Interface for waiting for completion of an operation */ |