use of org.apache.geode.modules.util.RegionConfiguration in project geode by apache.
the class AbstractSessionCache method createRegionConfiguration.
/**
* Build up a {@code RegionConfiguraton} object from parameters originally passed in as filter
* initialization parameters.
*
* @return a {@code RegionConfiguration} object
*/
protected RegionConfiguration createRegionConfiguration() {
RegionConfiguration configuration = new RegionConfiguration();
configuration.setRegionName((String) properties.get(CacheProperty.REGION_NAME));
configuration.setRegionAttributesId((String) properties.get(CacheProperty.REGION_ATTRIBUTES_ID));
configuration.setEnableGatewayDeltaReplication((Boolean) properties.get(CacheProperty.ENABLE_GATEWAY_DELTA_REPLICATION));
configuration.setEnableGatewayReplication((Boolean) properties.get(CacheProperty.ENABLE_GATEWAY_REPLICATION));
configuration.setEnableDebugListener((Boolean) properties.get(CacheProperty.ENABLE_DEBUG_LISTENER));
return configuration;
}
use of org.apache.geode.modules.util.RegionConfiguration in project geode by apache.
the class PeerToPeerSessionCache method createOrRetrieveRegion.
@SuppressWarnings("unchecked")
protected void createOrRetrieveRegion() {
// Create the RegionConfiguration
RegionConfiguration configuration = createRegionConfiguration();
configuration.setSessionExpirationCacheListener(true);
// Attempt to retrieve the region
// If it already exists, validate it
// If it doesn't already exist, create it
Region region = this.cache.getRegion(getSessionManager().getRegionName());
if (region == null) {
// Create the region
region = RegionHelper.createRegion((Cache) getCache(), configuration);
if (getSessionManager().getLogger().isDebugEnabled()) {
getSessionManager().getLogger().debug("Created new session region: " + region);
}
} else {
// Validate the existing region
if (getSessionManager().getLogger().isDebugEnabled()) {
getSessionManager().getLogger().debug("Retrieved existing session region: " + region);
}
RegionHelper.validateRegion((Cache) getCache(), configuration, region);
}
// Set the session region
this.sessionRegion = region;
}
use of org.apache.geode.modules.util.RegionConfiguration in project geode by apache.
the class AbstractSessionCache method createRegionConfiguration.
protected RegionConfiguration createRegionConfiguration() {
RegionConfiguration configuration = new RegionConfiguration();
configuration.setRegionName(getSessionManager().getRegionName());
configuration.setRegionAttributesId(getSessionManager().getRegionAttributesId());
if (getSessionManager().getMaxInactiveInterval() != RegionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL) {
configuration.setMaxInactiveInterval(getSessionManager().getMaxInactiveInterval());
configuration.setCustomExpiry(new SessionCustomExpiry());
}
configuration.setEnableGatewayDeltaReplication(getSessionManager().getEnableGatewayDeltaReplication());
configuration.setEnableGatewayReplication(getSessionManager().getEnableGatewayReplication());
configuration.setEnableDebugListener(getSessionManager().getEnableDebugListener());
return configuration;
}
use of org.apache.geode.modules.util.RegionConfiguration in project geode by apache.
the class ClientServerSessionCache method createSessionRegionOnServers.
private void createSessionRegionOnServers() {
// Create the RegionConfiguration
RegionConfiguration configuration = createRegionConfiguration();
// Send it to the server tier
Execution execution = FunctionService.onServer(this.cache).setArguments(configuration);
ResultCollector collector = execution.execute(CreateRegionFunction.ID);
// Verify the region was successfully created on the servers
List<RegionStatus> results = (List<RegionStatus>) collector.getResult();
for (RegionStatus status : results) {
if (status == RegionStatus.INVALID) {
StringBuilder builder = new StringBuilder();
builder.append("An exception occurred on the server while attempting to create or validate region named ").append(getSessionManager().getRegionName()).append(". See the server log for additional details.");
throw new IllegalStateException(builder.toString());
}
}
}
use of org.apache.geode.modules.util.RegionConfiguration in project geode by apache.
the class PeerToPeerSessionCache method createOrRetrieveRegion.
private void createOrRetrieveRegion() {
// Create the RegionConfiguration
RegionConfiguration configuration = createRegionConfiguration();
// Attempt to retrieve the region
// If it already exists, validate it
// If it doesn't already exist, create it
Region region = this.cache.getRegion((String) properties.get(CacheProperty.REGION_NAME));
if (region == null) {
// Create the region
region = RegionHelper.createRegion(cache, configuration);
LOG.info("Created new session region: {}", region);
} else {
// Validate the existing region
LOG.info("Retrieved existing session region: {}", region);
RegionHelper.validateRegion(cache, configuration, region);
}
// Set the session region
this.sessionRegion = region;
}
Aggregations