Skip to content

Commit 28e8222

Browse files
author
Myron Scott
committed
tweak init
1 parent c0ca785 commit 28e8222

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

tc-server/src/main/java/com/tc/config/ServerConfigurationManager.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ public ProductInfo getProductInfo() {
7777
}
7878

7979
public void initialize() throws ConfigurationException {
80-
Lock lock = this.configurationProvider.lockAndInitialize(this.startUpArgs);
81-
82-
try {
83-
Configuration configuration = configurationProvider.getConfiguration();
80+
try (LockedConfiguration configuration = this.configurationProvider.lockAndInitialize(this.startUpArgs)) {
8481
if (configuration == null) {
8582
throw new ConfigurationException("unable to determine server configuration");
8683
}
@@ -92,8 +89,6 @@ public void initialize() throws ConfigurationException {
9289
thisServer = new StableServerConfiguration(base);
9390

9491
processTcProperties(configuration.getTcProperties());
95-
} finally {
96-
lock.unlock();
9792
}
9893
}
9994

@@ -300,10 +295,10 @@ List<ServerConfiguration> getStableServerConfigurations() {
300295
}
301296
}
302297

303-
Lock lockAndInitialize(List<String> configurationParams) throws ConfigurationException {
298+
LockedConfiguration lockAndInitialize(List<String> configurationParams) throws ConfigurationException {
304299
lock.lock();
305300
initialize(configurationParams);
306-
return lock;
301+
return new LockedConfiguration(delegateProvider.getConfiguration(), lock);
307302
}
308303

309304
@Override

0 commit comments

Comments
 (0)