Search in sources :

Example 1 with HashMapAdapter

use of com.hazelcast.mapreduce.impl.HashMapAdapter in project hazelcast by hazelcast.

the class ScheduledExecutorServiceProxy method scheduleOnMembersAtFixedRate.

@Override
public Map<Member, IScheduledFuture<?>> scheduleOnMembersAtFixedRate(Runnable command, Collection<Member> members, long initialDelay, long period, TimeUnit unit) {
    checkNotNull(command, "Command is null");
    checkNotNull(members, "Members is null");
    checkNotNull(unit, "Unit is null");
    attachHazelcastInstance(command);
    String name = extractNameOrGenerateOne(command);
    ScheduledRunnableAdapter<?> adapter = createScheduledRunnableAdapter(command);
    Map<Member, IScheduledFuture<?>> futures = new HashMapAdapter<Member, IScheduledFuture<?>>();
    for (Member member : members) {
        TaskDefinition definition = new TaskDefinition(TaskDefinition.Type.AT_FIXED_RATE, name, adapter, initialDelay, period, unit);
        futures.put(member, submitOnMemberSync(name, new ScheduleTaskOperation(getName(), definition), member));
    }
    return futures;
}
Also used : IScheduledFuture(com.hazelcast.scheduledexecutor.IScheduledFuture) ScheduleTaskOperation(com.hazelcast.scheduledexecutor.impl.operations.ScheduleTaskOperation) HashMapAdapter(com.hazelcast.mapreduce.impl.HashMapAdapter) Member(com.hazelcast.core.Member)

Aggregations

Member (com.hazelcast.core.Member)1 HashMapAdapter (com.hazelcast.mapreduce.impl.HashMapAdapter)1 IScheduledFuture (com.hazelcast.scheduledexecutor.IScheduledFuture)1 ScheduleTaskOperation (com.hazelcast.scheduledexecutor.impl.operations.ScheduleTaskOperation)1