Search in sources :

Example 1 with RegionStatus

use of org.apache.geode.modules.util.RegionStatus 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());
        }
    }
}
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)

Example 2 with RegionStatus

use of org.apache.geode.modules.util.RegionStatus 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

List (java.util.List)2 Execution (org.apache.geode.cache.execute.Execution)2 ResultCollector (org.apache.geode.cache.execute.ResultCollector)2 RegionConfiguration (org.apache.geode.modules.util.RegionConfiguration)2 RegionStatus (org.apache.geode.modules.util.RegionStatus)2