Skip to content

Commit

Permalink
Fix configuration to create new instance on load
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Jan 6, 2016
1 parent 052cdd1 commit 471507c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public class Configuration {
* of the proxy to use
*/
public static final String PROPERTY_HTTP_PROXY_PORT = "http.proxyPort";

/**
* The configuration instance.
*/
private static Configuration instance;

/**
* The configuration properties.
Expand All @@ -85,21 +80,14 @@ public Configuration(Builder builder) {
}

public static Configuration getInstance() {
if (instance == null) {
try {
instance = Configuration.load();
} catch (IOException e) {
log.error(
"Unable to load META-INF/com.microsoft.windowsazure.properties",
e);
instance = new Configuration();
}
try {
return Configuration.load();
} catch (IOException e) {
log.error(
"Unable to load META-INF/com.microsoft.windowsazure.properties",
e);
return new Configuration();
}
return instance;
}

public static void setInstance(final Configuration configuration) {
Configuration.instance = configuration;
}

public static Configuration load() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ public Client alter(String profile, Client instance,
});

// applied as default configuration
Configuration.setInstance(config);
service = ServiceBusService.create();
service = ServiceBusService.create(config);
}

@Test
Expand Down

0 comments on commit 471507c

Please sign in to comment.