Search in sources :

Example 31 with ResourceManager

use of org.apache.geode.cache.control.ResourceManager in project geode by apache.

the class TestFunction method executeWithLastResult.

private void executeWithLastResult(FunctionContext context) {
    RegionFunctionContext rfContext = (RegionFunctionContext) context;
    final PartitionedRegion pr = (PartitionedRegion) rfContext.getDataSet();
    ResourceManager resMan = pr.getCache().getResourceManager();
    RebalanceFactory factory = resMan.createRebalanceFactory();
    RebalanceOperation rebalanceOp = factory.start();
    try {
        RebalanceResults rebalanceResults = rebalanceOp.getResults();
    } catch (CancellationException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    context.getResultSender().lastResult((Serializable) context.getArguments());
}
Also used : RebalanceFactory(org.apache.geode.cache.control.RebalanceFactory) RebalanceOperation(org.apache.geode.cache.control.RebalanceOperation) CancellationException(java.util.concurrent.CancellationException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) RegionFunctionContext(org.apache.geode.cache.execute.RegionFunctionContext) ResourceManager(org.apache.geode.cache.control.ResourceManager) RebalanceResults(org.apache.geode.cache.control.RebalanceResults)

Aggregations

ResourceManager (org.apache.geode.cache.control.ResourceManager)31 RebalanceResults (org.apache.geode.cache.control.RebalanceResults)22 Cache (org.apache.geode.cache.Cache)20 PartitionRegionInfo (org.apache.geode.cache.partition.PartitionRegionInfo)19 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)19 Region (org.apache.geode.cache.Region)18 PartitionRebalanceInfo (org.apache.geode.cache.partition.PartitionRebalanceInfo)18 BucketRegion (org.apache.geode.internal.cache.BucketRegion)18 Host (org.apache.geode.test.dunit.Host)18 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)18 VM (org.apache.geode.test.dunit.VM)18 PartitionMemberInfo (org.apache.geode.cache.partition.PartitionMemberInfo)16 HashSet (java.util.HashSet)15 Set (java.util.Set)15 TreeSet (java.util.TreeSet)14 AttributesFactory (org.apache.geode.cache.AttributesFactory)13 PartitionAttributes (org.apache.geode.cache.PartitionAttributes)13 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)13 Test (org.junit.Test)8 RebalanceOperation (org.apache.geode.cache.control.RebalanceOperation)7