// For war agent needs to be switched on private boolean listenForDiscoveryMcRequests(Configuration pConfig) { // Check for system props, system env and agent config boolean sysProp = System.getProperty("jolokia." + ConfigKey.DISCOVERY_ENABLED.getKeyValue()) != null; boolean env = System.getenv("JOLOKIA_DISCOVERY") != null; boolean config = pConfig.getAsBoolean(ConfigKey.DISCOVERY_ENABLED); return sysProp || env || config; }
// init various application wide stores for handling history and debug output. private void initStores(Configuration pConfig) { int maxEntries = pConfig.getAsInt(HISTORY_MAX_ENTRIES); int maxDebugEntries = pConfig.getAsInt(DEBUG_MAX_ENTRIES); historyStore = new HistoryStore(maxEntries); debugStore = new DebugStore(maxDebugEntries, pConfig.getAsBoolean(DEBUG)); try { localDispatcher.initMBeans(historyStore, debugStore); } catch (NotCompliantMBeanException e) { intError("Error registering config MBean: " + e, e); } catch (MBeanRegistrationException e) { intError("Cannot register MBean: " + e, e); } catch (MalformedObjectNameException e) { intError("Invalid name for config MBean: " + e, e); } }