Search in sources :

Example 1 with DistributedScheduledExecutorService

use of com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService in project hazelcast by hazelcast.

the class ReplicationOperation method run.

@Override
public void run() throws Exception {
    DistributedScheduledExecutorService service = getService();
    ScheduledExecutorPartition partition = service.getPartition(getPartitionId());
    for (Map.Entry<String, Map<String, ScheduledTaskDescriptor>> entry : map.entrySet()) {
        ScheduledExecutorContainer container = partition.getOrCreateContainer(entry.getKey());
        for (Map.Entry<String, ScheduledTaskDescriptor> descriptorEntry : entry.getValue().entrySet()) {
            String taskName = descriptorEntry.getKey();
            ScheduledTaskDescriptor descriptor = descriptorEntry.getValue();
            if (!container.has(taskName)) {
                container.stash(descriptor);
            }
        }
    }
}
Also used : DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) ScheduledTaskDescriptor(com.hazelcast.scheduledexecutor.impl.ScheduledTaskDescriptor) ScheduledExecutorContainer(com.hazelcast.scheduledexecutor.impl.ScheduledExecutorContainer) ScheduledExecutorPartition(com.hazelcast.scheduledexecutor.impl.ScheduledExecutorPartition) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with DistributedScheduledExecutorService

use of com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService in project hazelcast by hazelcast.

the class ServiceManagerImpl method registerDefaultServices.

private void registerDefaultServices(ServicesConfig servicesConfig) {
    if (!servicesConfig.isEnableDefaults()) {
        return;
    }
    logger.finest("Registering default services...");
    registerService(MapService.SERVICE_NAME, createService(MapService.class));
    registerService(LockService.SERVICE_NAME, new LockServiceImpl(nodeEngine));
    registerService(QueueService.SERVICE_NAME, new QueueService(nodeEngine));
    registerService(TopicService.SERVICE_NAME, new TopicService());
    registerService(ReliableTopicService.SERVICE_NAME, new ReliableTopicService(nodeEngine));
    registerService(MultiMapService.SERVICE_NAME, new MultiMapService(nodeEngine));
    registerService(ListService.SERVICE_NAME, new ListService(nodeEngine));
    registerService(SetService.SERVICE_NAME, new SetService(nodeEngine));
    registerService(DistributedExecutorService.SERVICE_NAME, new DistributedExecutorService());
    registerService(DistributedDurableExecutorService.SERVICE_NAME, new DistributedDurableExecutorService(nodeEngine));
    registerService(AtomicLongService.SERVICE_NAME, new AtomicLongService());
    registerService(AtomicReferenceService.SERVICE_NAME, new AtomicReferenceService());
    registerService(CountDownLatchService.SERVICE_NAME, new CountDownLatchService());
    registerService(SemaphoreService.SERVICE_NAME, new SemaphoreService(nodeEngine));
    registerService(IdGeneratorService.SERVICE_NAME, new IdGeneratorService(nodeEngine));
    registerService(MapReduceService.SERVICE_NAME, new MapReduceService(nodeEngine));
    registerService(ReplicatedMapService.SERVICE_NAME, new ReplicatedMapService(nodeEngine));
    registerService(RingbufferService.SERVICE_NAME, new RingbufferService(nodeEngine));
    registerService(XAService.SERVICE_NAME, new XAService(nodeEngine));
    registerService(CardinalityEstimatorService.SERVICE_NAME, new CardinalityEstimatorService());
    registerService(DistributedScheduledExecutorService.SERVICE_NAME, new DistributedScheduledExecutorService());
    registerCacheServiceIfAvailable();
    readServiceDescriptors();
}
Also used : DistributedDurableExecutorService(com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService) XAService(com.hazelcast.transaction.impl.xa.XAService) SemaphoreService(com.hazelcast.concurrent.semaphore.SemaphoreService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) LockServiceImpl(com.hazelcast.concurrent.lock.LockServiceImpl) SetService(com.hazelcast.collection.impl.set.SetService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) IdGeneratorService(com.hazelcast.concurrent.idgen.IdGeneratorService) ListService(com.hazelcast.collection.impl.list.ListService) TopicService(com.hazelcast.topic.impl.TopicService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) AtomicLongService(com.hazelcast.concurrent.atomiclong.AtomicLongService) DistributedExecutorService(com.hazelcast.executor.impl.DistributedExecutorService) CountDownLatchService(com.hazelcast.concurrent.countdownlatch.CountDownLatchService) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) CardinalityEstimatorService(com.hazelcast.cardinality.impl.CardinalityEstimatorService) AtomicReferenceService(com.hazelcast.concurrent.atomicreference.AtomicReferenceService)

Example 3 with DistributedScheduledExecutorService

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());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) Config(com.hazelcast.config.Config) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 4 with DistributedScheduledExecutorService

use of com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService in project hazelcast by hazelcast.

the class AbstractSchedulerOperation method getContainer.

public ScheduledExecutorContainer getContainer() {
    checkNotShutdown();
    DistributedScheduledExecutorService service = getService();
    return service.getPartitionOrMemberBin(getPartitionId()).getOrCreateContainer(schedulerName);
}
Also used : DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService)

Example 5 with DistributedScheduledExecutorService

use of com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService in project hazelcast by hazelcast.

the class GetAllScheduledOnMemberOperation method run.

@Override
public void run() throws Exception {
    List<ScheduledTaskHandler> handlers = new ArrayList<ScheduledTaskHandler>();
    DistributedScheduledExecutorService service = getService();
    populateScheduledForHolder(handlers, service, MEMBER_BIN);
    response = handlers;
}
Also used : DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) ScheduledTaskHandler(com.hazelcast.scheduledexecutor.ScheduledTaskHandler) ArrayList(java.util.ArrayList)

Aggregations

DistributedScheduledExecutorService (com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService)6 ScheduledTaskHandler (com.hazelcast.scheduledexecutor.ScheduledTaskHandler)2 ArrayList (java.util.ArrayList)2 CardinalityEstimatorService (com.hazelcast.cardinality.impl.CardinalityEstimatorService)1 ListService (com.hazelcast.collection.impl.list.ListService)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 SetService (com.hazelcast.collection.impl.set.SetService)1 AtomicLongService (com.hazelcast.concurrent.atomiclong.AtomicLongService)1 AtomicReferenceService (com.hazelcast.concurrent.atomicreference.AtomicReferenceService)1 CountDownLatchService (com.hazelcast.concurrent.countdownlatch.CountDownLatchService)1 IdGeneratorService (com.hazelcast.concurrent.idgen.IdGeneratorService)1 LockServiceImpl (com.hazelcast.concurrent.lock.LockServiceImpl)1 SemaphoreService (com.hazelcast.concurrent.semaphore.SemaphoreService)1 Config (com.hazelcast.config.Config)1 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 DistributedDurableExecutorService (com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 MapService (com.hazelcast.map.impl.MapService)1 MapReduceService (com.hazelcast.mapreduce.impl.MapReduceService)1