use of com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService in project hazelcast by hazelcast.
the class ScheduledExecutorServiceBasicTest method config.
@Test
public void config() throws ExecutionException, InterruptedException {
String schedulerName = "foobar";
ScheduledExecutorConfig sec = new ScheduledExecutorConfig().setName(schedulerName).setDurability(5).setPoolSize(24);
Config config = new Config().addScheduledExecutorConfig(sec);
HazelcastInstance[] instances = createClusterWithCount(1, config);
IScheduledFuture future = instances[0].getScheduledExecutorService(schedulerName).schedule(new PlainCallableTask(), 0, SECONDS);
NodeEngineImpl nodeEngine = getNodeEngineImpl(instances[0]);
ManagedExecutorService mes = (ManagedExecutorService) nodeEngine.getExecutionService().getScheduledDurable(sec.getName());
DistributedScheduledExecutorService dses = nodeEngine.getService(DistributedScheduledExecutorService.SERVICE_NAME);
assertNotNull(mes);
assertEquals(24, mes.getMaximumPoolSize());
assertEquals(5, dses.getPartition(future.getHandler().getPartitionId()).getOrCreateContainer(schedulerName).getDurability());
assertEquals(1, dses.getPartition(future.getHandler().getPartitionId()).getOrCreateContainer("other").getDurability());
}
Aggregations