use of com.hazelcast.scheduledexecutor.IScheduledFuture in project hazelcast by hazelcast.
the class ScheduledExecutorServiceProxy method scheduleOnMembers.
@Override
public <V> Map<Member, IScheduledFuture<V>> scheduleOnMembers(Callable<V> command, Collection<Member> members, long delay, TimeUnit unit) {
checkNotNull(command, "Command is null");
checkNotNull(members, "Members is null");
checkNotNull(unit, "Unit is null");
attachHazelcastInstance(command);
String name = extractNameOrGenerateOne(command);
Map<Member, IScheduledFuture<V>> futures = new HashMap<Member, IScheduledFuture<V>>();
for (Member member : members) {
TaskDefinition<V> definition = new TaskDefinition<V>(TaskDefinition.Type.SINGLE_RUN, name, command, delay, unit);
futures.put(member, (IScheduledFuture<V>) submitOnMemberSync(name, new ScheduleTaskOperation(getName(), definition), member));
}
return futures;
}
Aggregations