use of com.hazelcast.scheduledexecutor.impl.TaskDefinition in project hazelcast by hazelcast.
the class ClientScheduledExecutorProxy method scheduleAtFixedRate.
@Override
public IScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
checkNotNull(command, "Command is null");
checkNotNull(unit, "Unit is null");
String name = extractNameOrGenerateOne(command);
int partitionId = getTaskOrKeyPartitionId(command, name);
Callable adapter = createScheduledRunnableAdapter(command);
TaskDefinition definition = new TaskDefinition(TaskDefinition.Type.AT_FIXED_RATE, name, adapter, initialDelay, period, unit);
return scheduleOnPartition(name, definition, partitionId);
}
use of com.hazelcast.scheduledexecutor.impl.TaskDefinition in project hazelcast by hazelcast.
the class ScheduledExecutorSubmitToAddressMessageTask method getParameters.
@Override
public Object[] getParameters() {
Callable callable = serializationService.toObject(parameters.task);
TaskDefinition def = new TaskDefinition(TaskDefinition.Type.getById(parameters.type), parameters.taskName, callable, parameters.initialDelayInMillis, parameters.periodInMillis, TimeUnit.MILLISECONDS);
return new Object[] { parameters.schedulerName, parameters.address, def };
}
use of com.hazelcast.scheduledexecutor.impl.TaskDefinition in project hazelcast by hazelcast.
the class ScheduledExecutorSubmitToAddressMessageTask method prepareOperation.
@Override
protected Operation prepareOperation() {
Callable callable = serializationService.toObject(parameters.task);
TaskDefinition def = new TaskDefinition(TaskDefinition.Type.getById(parameters.type), parameters.taskName, callable, parameters.initialDelayInMillis, parameters.periodInMillis, TimeUnit.MILLISECONDS);
return new ScheduleTaskOperation(parameters.schedulerName, def);
}
use of com.hazelcast.scheduledexecutor.impl.TaskDefinition in project hazelcast by hazelcast.
the class ScheduledExecutorSubmitToPartitionMessageTask method prepareOperation.
@Override
protected Operation prepareOperation() {
Callable callable = serializationService.toObject(parameters.task);
TaskDefinition def = new TaskDefinition(TaskDefinition.Type.getById(parameters.type), parameters.taskName, callable, parameters.initialDelayInMillis, parameters.periodInMillis, TimeUnit.MILLISECONDS);
return new ScheduleTaskOperation(parameters.schedulerName, def);
}
Aggregations