Skip to content

Commit 1ce3be1

Browse files
author
Myron Scott
committed
tweak init
1 parent 4c32eaa commit 1ce3be1

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

@@ -267,10 +262,10 @@ List<ServerConfiguration> getStableServerConfigurations() {
267262
}
268263
}
269264

270-
Lock lockAndInitialize(List<String> configurationParams) throws ConfigurationException {
265+
LockedConfiguration lockAndInitialize(List<String> configurationParams) throws ConfigurationException {
271266
lock.lock();
272267
initialize(configurationParams);
273-
return lock;
268+
return new LockedConfiguration(delegateProvider.getConfiguration(), lock);
274269
}
275270

276271
@Override

0 commit comments

Comments
 (0)