Search in sources :

Example 1 with TaskScheduler

use of com.hazelcast.spi.TaskScheduler in project hazelcast by hazelcast.

the class JobSupervisor method asyncCancelRemoteOperations.

private void asyncCancelRemoteOperations(final Set<Address> addresses) {
    final NodeEngine nodeEngine = mapReduceService.getNodeEngine();
    TaskScheduler taskScheduler = nodeEngine.getExecutionService().getGlobalTaskScheduler();
    taskScheduler.execute(new Runnable() {

        @Override
        public void run() {
            String name = getConfiguration().getName();
            String jobId = getConfiguration().getJobId();
            for (Address address : addresses) {
                try {
                    CancelJobSupervisorOperation operation = new CancelJobSupervisorOperation(name, jobId);
                    mapReduceService.processRequest(address, operation);
                } catch (Exception ignore) {
                    // We can ignore this exception since we just want to cancel the job
                    // and the member may be crashed or unreachable in some way
                    ILogger logger = nodeEngine.getLogger(JobSupervisor.class);
                    logger.finest("Remote node may already be down", ignore);
                }
            }
        }
    });
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Address(com.hazelcast.nio.Address) ILogger(com.hazelcast.logging.ILogger) TaskScheduler(com.hazelcast.spi.TaskScheduler) CancelJobSupervisorOperation(com.hazelcast.mapreduce.impl.operation.CancelJobSupervisorOperation)

Example 2 with TaskScheduler

use of com.hazelcast.spi.TaskScheduler in project hazelcast by hazelcast.

the class LockStoreContainer method createScheduler.

private EntryTaskScheduler<Data, Integer> createScheduler(ObjectNamespace namespace) {
    NodeEngine nodeEngine = lockService.getNodeEngine();
    LockEvictionProcessor entryProcessor = new LockEvictionProcessor(nodeEngine, namespace);
    TaskScheduler globalScheduler = nodeEngine.getExecutionService().getGlobalTaskScheduler();
    return EntryTaskSchedulerFactory.newScheduler(globalScheduler, entryProcessor, ScheduleType.FOR_EACH);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) TaskScheduler(com.hazelcast.spi.TaskScheduler) EntryTaskScheduler(com.hazelcast.util.scheduler.EntryTaskScheduler)

Aggregations

NodeEngine (com.hazelcast.spi.NodeEngine)2 TaskScheduler (com.hazelcast.spi.TaskScheduler)2 ILogger (com.hazelcast.logging.ILogger)1 CancelJobSupervisorOperation (com.hazelcast.mapreduce.impl.operation.CancelJobSupervisorOperation)1 Address (com.hazelcast.nio.Address)1 EntryTaskScheduler (com.hazelcast.util.scheduler.EntryTaskScheduler)1