Search in sources :

Example 1 with GetResultOperationFactory

use of com.hazelcast.mapreduce.impl.operation.GetResultOperationFactory in project hazelcast by hazelcast.

the class JobSupervisor method checkFullyProcessed.

public void checkFullyProcessed(JobProcessInformation processInformation) {
    if (isOwnerNode()) {
        JobPartitionState[] partitionStates = processInformation.getPartitionStates();
        for (JobPartitionState partitionState : partitionStates) {
            if (partitionState == null || partitionState.getState() != JobPartitionState.State.PROCESSED) {
                return;
            }
        }
        final String name = configuration.getName();
        final String jobId = configuration.getJobId();
        final NodeEngine nodeEngine = configuration.getNodeEngine();
        final GetResultOperationFactory operationFactory = new GetResultOperationFactory(name, jobId);
        // Get the initial future object to eventually set the result and cleanup
        final TrackableJobFuture future = jobTracker.unregisterTrackableJob(jobId);
        if (future == null) {
            // If already handled just return
            return;
        }
        final JobSupervisor jobSupervisor = this;
        Runnable runnable = new GetResultsRunnable(nodeEngine, operationFactory, jobId, jobSupervisor, future);
        ExecutionService executionService = nodeEngine.getExecutionService();
        ManagedExecutorService executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
        executor.submit(runnable);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) JobPartitionState(com.hazelcast.mapreduce.JobPartitionState) GetResultOperationFactory(com.hazelcast.mapreduce.impl.operation.GetResultOperationFactory) ExecutionService(com.hazelcast.spi.ExecutionService)

Aggregations

JobPartitionState (com.hazelcast.mapreduce.JobPartitionState)1 GetResultOperationFactory (com.hazelcast.mapreduce.impl.operation.GetResultOperationFactory)1 ExecutionService (com.hazelcast.spi.ExecutionService)1 NodeEngine (com.hazelcast.spi.NodeEngine)1 ManagedExecutorService (com.hazelcast.util.executor.ManagedExecutorService)1