Search in sources :

Example 1 with ScheduledExecutorContainer

use of com.hazelcast.scheduledexecutor.impl.ScheduledExecutorContainer 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 ScheduledExecutorContainer

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

the class AbstractGetAllScheduledOperation method populateScheduledForHolder.

protected void populateScheduledForHolder(List<ScheduledTaskHandler> handlers, DistributedScheduledExecutorService service, int holderId) {
    ScheduledExecutorContainerHolder partition = service.getPartitionOrMemberBin(holderId);
    ScheduledExecutorContainer container = partition.getContainer(schedulerName);
    if (container == null || service.isShutdown(schedulerName)) {
        return;
    }
    Collection<ScheduledTaskDescriptor> tasks = container.getTasks();
    for (ScheduledTaskDescriptor task : tasks) {
        if (task.isTaskOwner()) {
            handlers.add(container.offprintHandler(task.getDefinition().getName()));
        }
    }
}
Also used : ScheduledExecutorContainerHolder(com.hazelcast.scheduledexecutor.impl.ScheduledExecutorContainerHolder) ScheduledTaskDescriptor(com.hazelcast.scheduledexecutor.impl.ScheduledTaskDescriptor) ScheduledExecutorContainer(com.hazelcast.scheduledexecutor.impl.ScheduledExecutorContainer)

Aggregations

ScheduledExecutorContainer (com.hazelcast.scheduledexecutor.impl.ScheduledExecutorContainer)2 ScheduledTaskDescriptor (com.hazelcast.scheduledexecutor.impl.ScheduledTaskDescriptor)2 DistributedScheduledExecutorService (com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService)1 ScheduledExecutorContainerHolder (com.hazelcast.scheduledexecutor.impl.ScheduledExecutorContainerHolder)1 ScheduledExecutorPartition (com.hazelcast.scheduledexecutor.impl.ScheduledExecutorPartition)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1