Search in sources :

Example 6 with RegionConfiguration

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 ");
            builder.append(properties.get(CacheProperty.REGION_NAME));
            builder.append(". See the server log for additional details.");
            throw new IllegalStateException(builder.toString());
        }
    }
}
Also used : RegionConfiguration(org.apache.geode.modules.util.RegionConfiguration) Execution(org.apache.geode.cache.execute.Execution) RegionStatus(org.apache.geode.modules.util.RegionStatus) List(java.util.List) ResultCollector(org.apache.geode.cache.execute.ResultCollector)

Aggregations

RegionConfiguration (org.apache.geode.modules.util.RegionConfiguration)6 List (java.util.List)2 Region (org.apache.geode.cache.Region)2 Execution (org.apache.geode.cache.execute.Execution)2 ResultCollector (org.apache.geode.cache.execute.ResultCollector)2 RegionStatus (org.apache.geode.modules.util.RegionStatus)2 Cache (org.apache.geode.cache.Cache)1 GemFireCache (org.apache.geode.cache.GemFireCache)1 SessionCustomExpiry (org.apache.geode.modules.util.SessionCustomExpiry)1