From 28e82222285166dc8c52e3918dd35f69294fc770 Mon Sep 17 00:00:00 2001 From: Myron Scott Date: Mon, 21 Oct 2024 10:35:25 -0700 Subject: [PATCH] tweak init --- .../com/tc/config/ServerConfigurationManager.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tc-server/src/main/java/com/tc/config/ServerConfigurationManager.java b/tc-server/src/main/java/com/tc/config/ServerConfigurationManager.java index db195ce80b..2a0c2ed803 100644 --- a/tc-server/src/main/java/com/tc/config/ServerConfigurationManager.java +++ b/tc-server/src/main/java/com/tc/config/ServerConfigurationManager.java @@ -77,10 +77,7 @@ public ProductInfo getProductInfo() { } public void initialize() throws ConfigurationException { - Lock lock = this.configurationProvider.lockAndInitialize(this.startUpArgs); - - try { - Configuration configuration = configurationProvider.getConfiguration(); + try (LockedConfiguration configuration = this.configurationProvider.lockAndInitialize(this.startUpArgs)) { if (configuration == null) { throw new ConfigurationException("unable to determine server configuration"); } @@ -92,8 +89,6 @@ public void initialize() throws ConfigurationException { thisServer = new StableServerConfiguration(base); processTcProperties(configuration.getTcProperties()); - } finally { - lock.unlock(); } } @@ -300,10 +295,10 @@ List getStableServerConfigurations() { } } - Lock lockAndInitialize(List configurationParams) throws ConfigurationException { + LockedConfiguration lockAndInitialize(List configurationParams) throws ConfigurationException { lock.lock(); initialize(configurationParams); - return lock; + return new LockedConfiguration(delegateProvider.getConfiguration(), lock); } @Override