/** * Used by tests to create a default instance without reading in properties. */ static DistributionConfig createDefaultInstance() { return new DistributionConfigImpl(); }
/** * For WAN 70 Exchange the locator information within the distributed system * */ private void exchangeLocalLocators(int port, DistributionConfigImpl config, LocatorMembershipListener locatorListener, final String hostnameForClients) { String localLocator = config.getStartLocator(); DistributionLocatorId locatorId = null; if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) { locatorId = new DistributionLocatorId(port, config.getBindAddress(), hostnameForClients); } else { locatorId = new DistributionLocatorId(localLocator); } LocatorHelper.addLocator(config.getDistributedSystemId(), locatorId, locatorListener, null); RemoteLocatorJoinRequest request = buildRemoteDSJoinRequest(port, config, hostnameForClients); StringTokenizer locatorsOnThisVM = new StringTokenizer(config.getLocators(), ","); while (locatorsOnThisVM.hasMoreTokens()) { DistributionLocatorId localLocatorId = new DistributionLocatorId(locatorsOnThisVM.nextToken()); if (!locatorId.equals(localLocatorId)) { LocatorDiscovery localDiscovery = new LocatorDiscovery(this, localLocatorId, request, locatorListener); LocatorDiscovery.LocalLocatorDiscovery localLocatorDiscovery = localDiscovery.new LocalLocatorDiscovery(); this._executor.execute(localLocatorDiscovery); } } }
@Override public int getJmxManagerHttpPort() { return getHttpServicePort(); }
if (StringUtils.isEmpty(getSSLDefaultAlias())) { boolean correctAlias = true; correctAlias &= isAliasCorrectlyConfiguredForComponents(SecurableCommunicationChannel.CLUSTER); correctAlias &= isAliasCorrectlyConfiguredForComponents(SecurableCommunicationChannel.GATEWAY); correctAlias &= isAliasCorrectlyConfiguredForComponents(SecurableCommunicationChannel.WEB); correctAlias &= isAliasCorrectlyConfiguredForComponents(SecurableCommunicationChannel.JMX); correctAlias &= isAliasCorrectlyConfiguredForComponents(SecurableCommunicationChannel.LOCATOR); correctAlias &= isAliasCorrectlyConfiguredForComponents(SecurableCommunicationChannel.SERVER); return correctAlias; return StringUtils.isEmpty(getClusterSSLAlias()) || getSecurableCommunicationChannels().length <= 1 || !StringUtils .isEmpty(getSSLDefaultAlias()); return StringUtils.isEmpty(getGatewaySSLAlias()) || getSecurableCommunicationChannels().length <= 1 || !StringUtils .isEmpty(getSSLDefaultAlias()); return StringUtils.isEmpty(getHTTPServiceSSLAlias()) || getSecurableCommunicationChannels().length <= 1 || !StringUtils .isEmpty(getSSLDefaultAlias()); return StringUtils.isEmpty(getJMXSSLAlias())
private RemoteLocatorJoinRequest buildRemoteDSJoinRequest(int port, DistributionConfigImpl config, final String hostnameForClients) { String localLocator = config.getStartLocator(); DistributionLocatorId locatorId = null; if (localLocator.equals(DistributionConfig.DEFAULT_START_LOCATOR)) { locatorId = new DistributionLocatorId(port, config.getBindAddress(), hostnameForClients); } else { locatorId = new DistributionLocatorId(localLocator); } RemoteLocatorJoinRequest request = new RemoteLocatorJoinRequest(config.getDistributedSystemId(), locatorId, ""); return request; }
void setApiProps(Properties apiProps) { if (apiProps != null) { setSource(apiProps, ConfigSource.api()); modifiable = true; Iterator it = apiProps.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); String propName = (String) me.getKey(); props.put(propName, me.getValue()); if (specialPropName(propName)) { continue; } String propVal = (String) me.getValue(); if (propVal != null) { setAttribute(propName, propVal.trim(), sourceMap.get(propName)); } } // Make attributes read only modifiable = false; } }
private static InternalDistributedSystem getAdminCnx() { InternalDistributedSystem.setCommandLineAdmin(true); Properties props = propertyOption; props.setProperty(LOG_LEVEL, "warning"); DistributionConfigImpl dsc = new DistributionConfigImpl(props); System.out.print("Connecting to distributed system:"); if (!"".equals(dsc.getLocators())) { System.out.println(" locators=" + dsc.getLocators()); } else { System.out.println(" mcast=" + dsc.getMcastAddress() + ":" + dsc.getMcastPort()); } InternalDistributedSystem ds = (InternalDistributedSystem) InternalDistributedSystem.connectForAdmin(props); Set existingMembers = ds.getDistributionManager().getDistributionManagerIds(); if (existingMembers.isEmpty()) { throw new RuntimeException("There are no members in the distributed system"); } return ds; }
@Test public void monitorHandlesDefunctThread() { final Properties nonDefault = new Properties(); final DistributionConfigImpl distributionConfigImpl = new DistributionConfigImpl(nonDefault); final long threadID = Long.MAX_VALUE; int timeLimit = distributionConfigImpl.getThreadMonitorTimeLimit(); AbstractExecutor absExtgroup = new PooledExecutorGroup(threadsMonitoringImpl, threadID); absExtgroup.setStartTime(absExtgroup.getStartTime() - timeLimit - 1); threadsMonitoringImpl.getMonitorMap().put(threadID, absExtgroup); assertTrue(threadsMonitoringImpl.getThreadsMonitoringProcess().mapValidation()); threadsMonitoringImpl.close(); }
this.config = new DistributionConfigImpl(this.env); this.env.clear(); this.env.putAll(this.config.getProps()); final boolean hasLogFileButConfigDoesNot = this.logFile != null && this.config.getLogFile() .toString().equals(DistributionConfig.DEFAULT_LOG_FILE.toString()); if (logWriter == null && hasLogFileButConfigDoesNot) { this.config.unsafeSetLogFile(this.logFile);
/** * Creates a new local distribution manager * * @param system The distributed system to which this distribution manager will send messages. * */ public LonerDistributionManager(InternalDistributedSystem system, InternalLogWriter logger) { this.system = system; this.logger = logger; this.localAddress = generateMemberId(); this.allIds = Collections.singleton(localAddress); this.viewMembers = new ArrayList<>(allIds); DistributionStats.enableClockStats = this.system.getConfig().getEnableTimeStatistics(); Properties nonDefault = new Properties(); DistributionConfigImpl distributionConfigImpl = new DistributionConfigImpl(nonDefault); if (distributionConfigImpl.getThreadMonitorEnabled()) { this.threadMonitor = new ThreadsMonitoringImpl(system); logger.info("[ThreadsMonitor] New Monitor object and process were created.\n"); } else { this.threadMonitor = new ThreadsMonitoringImplDummy(); logger.info("[ThreadsMonitor] Monitoring is disabled and will not be run.\n"); } }
@Test public void distributionConfigDefaults() { DistributionConfigImpl distributionConfig = new DistributionConfigImpl(new Properties()); assertFalse(distributionConfig.getValidateSerializableObjects()); assertEquals("!*", distributionConfig.getSerializableObjectFilter()); }
String locatorsProp = this.config.getLocators(); boolean networkPartitionDetectionEnabled = this.config.getEnableNetworkPartitionDetection(); String securityUDPDHAlgo = this.config.getSecurityUDPDHAlgo(); if (networkPartitionDetectionEnabled) { locatorsAreCoordinators = true; } else { String prop = this.config.getSecurityPeerAuthInit(); locatorsAreCoordinators = prop != null && !prop.isEmpty(); if (!locatorsAreCoordinators) {
@Test public void testLogLevel() { config.modifiable = true; config.setAttribute(LOG_LEVEL, "config", ConfigSource.api()); assertEquals(config.getLogLevel(), 700); config.setAttributeObject(SECURITY_LOG_LEVEL, "debug", ConfigSource.api()); assertEquals(config.getSecurityLogLevel(), 500); }
this.originalConfig = (DistributionConfigImpl) o; } else { this.originalConfig = new DistributionConfigImpl(nonDefault); ((DistributionConfigImpl) this.originalConfig).checkForDisallowedDefaults(); // throws
@Test public void testValidLocatorAddress() { String address = "81.240.0.1[7056]"; config.modifiable = true; config.setAttributeObject(START_LOCATOR, address, ConfigSource.api()); assertEquals(config.getStartLocator(), address); }
@Override public String getLocators() { if (startLocator != null && startLocator.length() > 0) { String locs = locators; String startL = getStartLocator(); int comma = startL.indexOf(','); if (comma >= 0) { startL = startL.substring(0, comma); } if (locs.length() > 0) { if (locs.contains(startL)) { return locs; // fix for bug 43929 } return locs + "," + startL; } else { return startL; } } return locators; }
if (specialPropName(propName)) { continue; setAttribute(propName, ((String) propVal).trim(), sourceMap.get(propName)); setAttribute(CLUSTER_SSL_ENABLED, (String) props.get(CLUSTER_SSL_ENABLED), sourceMap.get(CLUSTER_SSL_ENABLED)); setAttribute(SECURITY_PEER_AUTH_INIT, (String) props.get(SECURITY_PEER_AUTH_INIT), sourceMap.get(SECURITY_PEER_AUTH_INIT)); setAttribute(SECURITY_PEER_AUTHENTICATOR, (String) props.get(SECURITY_PEER_AUTHENTICATOR), sourceMap.get(SECURITY_PEER_AUTHENTICATOR));
@Test public void testLog4jLogLevel() { config.modifiable = true; config.setAttribute(LOG_LEVEL, "fatal", ConfigSource.api()); assertEquals(config.getLogLevel(), 1000); }
@Test public void testValidAttributeObject() { config.setAttributeObject(HTTP_SERVICE_PORT, 8080, ConfigSource.api()); assertEquals(config.getHttpServicePort(), 8080); }
String locatorsProp = this.config.getLocators(); if (StringUtils.isNotBlank(locatorsProp)) { if (!locatorsProp.contains(thisLocator)) { Properties updateEnv = new Properties(); updateEnv.setProperty(LOCATORS, locatorsProp); this.config.setApiProps(updateEnv);