private void executeDifferentExecutionPolicies(DistributedTaskExecutionPolicy policy) throws ExecutionException, InterruptedException {
assert address(0) instanceof TopologyAwareAddress;
assert address(1) instanceof TopologyAwareAddress;
Cache<Object, Object> cache1 = cache(0, CACHE_NAME);
Cache<Object, Object> cache2 = cache(1, CACHE_NAME);
cache1.put("key1", "value1");
cache1.put("key2", "value2");
cache1.put("key3", "value3");
cache1.put("key4", "value4");
cache2.put("key5", "value5");
cache2.put("key6", "value6");
DistributedExecutorService des = new DefaultExecutorService(cache1);
try {
DistributedTaskBuilder<Boolean> taskBuilder = des.createDistributedTaskBuilder(new LocalDistributedExecutorTest.SimpleDistributedCallable(true));
taskBuilder.executionPolicy(policy);
DistributedTask<Boolean> distributedTask = taskBuilder.build();
Future<Boolean> future = des.submit(distributedTask, "key1", "key6");
assert future.get();
} finally {
des.shutdownNow();
}
}
}