Skip to content

Commit

Permalink
WELD-1290 Make it possible enable/disable concurrent bootstrap during…
Browse files Browse the repository at this point in the history
… integration test run
  • Loading branch information
luksa authored and jharting committed Aug 5, 2013
1 parent ed0cc79 commit 3630c81
Showing 1 changed file with 13 additions and 5 deletions.
Expand Up @@ -27,6 +27,7 @@
public class FileBasedBootstrapConfiguration implements BootstrapConfiguration {

private static final String CONFIGURATION_FILE = "org.jboss.weld.bootstrap.properties";
private static final String SYSTEM_PROPERTY_PREFIX = CONFIGURATION_FILE + ".";

private static final String CONCURRENT_DEPLOYMENT = "concurrentDeployment";
private static final String PRELOADER_THREAD_POOL_SIZE = "preloaderThreadPoolSize";
Expand Down Expand Up @@ -56,10 +57,10 @@ private static Properties loadProperties(URL url) {
}

private static int initIntValue(Properties properties, String property, int defaultValue) {
if (properties == null || properties.get(property) == null) {
String value = getSystemOrFileProperty(properties, property);
if (value == null) {
return defaultValue;
}
String value = properties.getProperty(property);
try {
return Integer.valueOf(value);
} catch (NumberFormatException e) {
Expand All @@ -68,10 +69,17 @@ private static int initIntValue(Properties properties, String property, int defa
}

private static boolean initBooleanValue(Properties properties, String property, boolean defaultValue) {
if (properties == null || properties.get(property) == null) {
return defaultValue;
String value = getSystemOrFileProperty(properties, property);
return value == null ? defaultValue : Boolean.valueOf(value);
}

private static String getSystemOrFileProperty(Properties properties, String property) {
String value = System.getProperty(SYSTEM_PROPERTY_PREFIX + property);
if (value == null && properties != null) {
return properties.getProperty(property);
} else {
return value;
}
return Boolean.valueOf(properties.getProperty(property));
}

public boolean isConcurrentDeploymentEnabled() {
Expand Down

0 comments on commit 3630c81

Please sign in to comment.