use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class GMSMembershipManager method init.
@Override
public void init(Services services) {
this.services = services;
Assert.assertTrue(services != null);
DistributionConfig config = services.getConfig().getDistributionConfig();
RemoteTransportConfig transport = services.getConfig().getTransport();
this.membershipCheckTimeout = config.getSecurityPeerMembershipTimeout();
this.wasReconnectingSystem = transport.getIsReconnectingDS();
// cache these settings for use in send()
this.mcastEnabled = transport.isMcastEnabled();
this.tcpDisabled = transport.isTcpDisabled();
if (!this.tcpDisabled) {
dcReceiver = new MyDCReceiver(listener);
}
surpriseMemberTimeout = Math.max(20 * DistributionConfig.DEFAULT_MEMBER_TIMEOUT, 20 * config.getMemberTimeout());
surpriseMemberTimeout = Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "surprise-member-timeout", surpriseMemberTimeout).intValue();
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class GMSMembershipManager method start.
@Override
public void start() {
DistributionConfig config = services.getConfig().getDistributionConfig();
int dcPort = 0;
if (!tcpDisabled) {
directChannel = new DirectChannel(this, dcReceiver, config);
dcPort = directChannel.getPort();
}
services.getMessenger().getMemberID().setDirectChannelPort(dcPort);
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class GemFireCacheImpl method requestSharedConfiguration.
/**
* Request the shared configuration from the locator(s) which have the Cluster config service
* running
*/
private ConfigurationResponse requestSharedConfiguration() {
final DistributionConfig config = this.system.getConfig();
if (!(this.dm instanceof DistributionManager)) {
return null;
}
// do nothing if this vm is/has locator or this is a client
if (this.dm.getDMType() == DistributionManager.LOCATOR_DM_TYPE || this.isClient || Locator.getLocator() != null) {
return null;
}
// can't simply return null if server is not using shared configuration, since we need to find
// out
// if the locator is running in secure mode or not, if yes, then we need to throw an exception
// if server is not using cluster config
Map<InternalDistributedMember, Collection<String>> scl = getDistributionManager().getAllHostedLocatorsWithSharedConfiguration();
// then do not make requests to the locators
if (scl.isEmpty()) {
logger.info(LocalizedMessage.create(LocalizedStrings.GemFireCache_NO_LOCATORS_FOUND_WITH_SHARED_CONFIGURATION));
return null;
}
List<String> locatorConnectionStrings = getSharedConfigLocatorConnectionStringList();
try {
ConfigurationResponse response = ClusterConfigurationLoader.requestConfigurationFromLocators(this.system.getConfig(), locatorConnectionStrings);
// log the configuration received from the locator
logger.info(LocalizedMessage.create(LocalizedStrings.GemFireCache_RECEIVED_SHARED_CONFIGURATION_FROM_LOCATORS));
logger.info(response.describeConfig());
Configuration clusterConfig = response.getRequestedConfiguration().get(ClusterConfigurationService.CLUSTER_CONFIG);
Properties clusterSecProperties = clusterConfig == null ? new Properties() : clusterConfig.getGemfireProperties();
// If not using shared configuration, return null or throw an exception is locator is secured
if (!config.getUseSharedConfiguration()) {
if (clusterSecProperties.containsKey(ConfigurationProperties.SECURITY_MANAGER)) {
throw new GemFireConfigException(LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION_2.toLocalizedString());
} else {
logger.info(LocalizedMessage.create(LocalizedStrings.GemFireCache_NOT_USING_SHARED_CONFIGURATION));
return null;
}
}
Properties serverSecProperties = config.getSecurityProps();
// check for possible mis-configuration
if (isMisConfigured(clusterSecProperties, serverSecProperties, ConfigurationProperties.SECURITY_MANAGER) || isMisConfigured(clusterSecProperties, serverSecProperties, ConfigurationProperties.SECURITY_POST_PROCESSOR)) {
throw new GemFireConfigException(LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION.toLocalizedString());
}
return response;
} catch (ClusterConfigurationNotAvailableException e) {
throw new GemFireConfigException(LocalizedStrings.GemFireCache_SHARED_CONFIGURATION_NOT_AVAILABLE.toLocalizedString(), e);
} catch (UnknownHostException e) {
throw new GemFireConfigException(e.getLocalizedMessage(), e);
}
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class AdminDistributedSystemFactory method defineDistributedSystem.
/**
* Defines a "default" distributed system configuration based on VM system properties and the
* content of <code>gemfire.properties</code>. The
* {@linkplain DistributedSystemConfig#DEFAULT_REMOTE_COMMAND} default remote command is used.
*
* @see DistributedSystem#connect
*/
public static DistributedSystemConfig defineDistributedSystem() {
DistributionConfig dc = new DistributionConfigImpl(new Properties());
String remoteCommand = DistributedSystemConfig.DEFAULT_REMOTE_COMMAND;
return new DistributedSystemConfigImpl(dc, remoteCommand);
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class GemFireMemberStatus method initializeDistributedSystem.
protected void initializeDistributedSystem(DistributedSystem distributedSystem) {
InternalDistributedSystem ids = (InternalDistributedSystem) distributedSystem;
setMemberId(ids.getMemberId());
DistributionConfig config = ids.getConfig();
setMemberName(config.getName());
setMcastPort(config.getMcastPort());
setMcastAddress(config.getMcastAddress());
String bindAddress = config.getBindAddress();
setBindAddress(bindAddress);
setLocators(config.getLocators());
setUpTime(System.currentTimeMillis() - ids.getStartTime());
try {
setHostAddress((bindAddress != null && bindAddress.length() > 0) ? InetAddress.getByName(bindAddress) : SocketCreator.getLocalHost());
} catch (IOException e) {
/* ignore - leave null host address */
}
}
Aggregations