Skip to content

Commit 471507c

Browse files
committed
Fix configuration to create new instance on load
1 parent 052cdd1 commit 471507c

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

core/azure-core/src/main/java/com/microsoft/windowsazure/Configuration.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ public class Configuration {
5656
* of the proxy to use
5757
*/
5858
public static final String PROPERTY_HTTP_PROXY_PORT = "http.proxyPort";
59-
60-
/**
61-
* The configuration instance.
62-
*/
63-
private static Configuration instance;
6459

6560
/**
6661
* The configuration properties.
@@ -85,21 +80,14 @@ public Configuration(Builder builder) {
8580
}
8681

8782
public static Configuration getInstance() {
88-
if (instance == null) {
89-
try {
90-
instance = Configuration.load();
91-
} catch (IOException e) {
92-
log.error(
93-
"Unable to load META-INF/com.microsoft.windowsazure.properties",
94-
e);
95-
instance = new Configuration();
96-
}
83+
try {
84+
return Configuration.load();
85+
} catch (IOException e) {
86+
log.error(
87+
"Unable to load META-INF/com.microsoft.windowsazure.properties",
88+
e);
89+
return new Configuration();
9790
}
98-
return instance;
99-
}
100-
101-
public static void setInstance(final Configuration configuration) {
102-
Configuration.instance = configuration;
10391
}
10492

10593
public static Configuration load() throws IOException {

services/azure-servicebus/src/test/java/com/microsoft/windowsazure/services/servicebus/ServiceBusIntegrationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ public Client alter(String profile, Client instance,
9595
});
9696

9797
// applied as default configuration
98-
Configuration.setInstance(config);
99-
service = ServiceBusService.create();
98+
service = ServiceBusService.create(config);
10099
}
101100

102101
@Test

0 commit comments

Comments
 (0)