/** * Initializes the Archaius system and configures the Netty leak detection level (if necessary). * DO NOT CALL THIS DIRECTLY. Use {@link #launchServer(String[])} when you're ready to start the server. */ protected void infrastructureInit() { MainClassUtils.setupJbossLoggingToUseSlf4j(); try { Pair<String, String> appIdAndEnvironmentPair = MainClassUtils.getAppIdAndEnvironmentFromSystemProperties(); ConfigurationManager.loadCascadedPropertiesFromResources(appIdAndEnvironmentPair.getLeft()); } catch (IOException e) { throw new RuntimeException("Error loading Archaius properties", e); } AbstractConfiguration appConfig = ConfigurationManager.getConfigInstance(); Function<String, Boolean> hasPropertyFunction = (propKey) -> appConfig.getProperty(propKey) != null; Function<String, String> propertyExtractionFunction = (propKey) -> { // Properties in Archaius might be a Collection or an Object. Object propValObj = appConfig.getProperty(propKey); return (propValObj instanceof Collection) ? ((Collection<?>) propValObj).stream().map(String::valueOf).collect(Collectors.joining(",")) : String.valueOf(propValObj); }; Set<String> propKeys = new LinkedHashSet<>(); appConfig.getKeys().forEachRemaining(propKeys::add); MainClassUtils.logApplicationPropertiesIfDebugActionsEnabled( hasPropertyFunction, propertyExtractionFunction, propKeys, false ); MainClassUtils.setupNettyLeakDetectionLevel(hasPropertyFunction, propertyExtractionFunction); }
/** * Initializes the Typesafe Config system and configures the Netty leak detection level (if necessary). * DO NOT CALL THIS DIRECTLY. Use {@link #launchServer(String[])} when you're ready to start the server. */ protected void infrastructureInit() { MainClassUtils.setupJbossLoggingToUseSlf4j(); Pair<String, String> appIdAndEnvironmentPair = getAppIdAndEnvironmentPair(); Config appConfig = TypesafeConfigUtil .loadConfigForAppIdAndEnvironment(appIdAndEnvironmentPair.getLeft(), appIdAndEnvironmentPair.getRight()); MainClassUtils.logApplicationPropertiesIfDebugActionsEnabled(appConfig::hasPath, (path) -> appConfig.getAnyRef(path).toString(), appConfig.entrySet().stream() .map(Map.Entry::getKey) .collect(Collectors.toList()), false); MainClassUtils.setupNettyLeakDetectionLevel(appConfig::hasPath, appConfig::getString); setAppConfig(appConfig); }
MainClassUtils.setupNettyLeakDetectionLevel(hasPropertyFunction, propertyExtractionFunction);