com.hazelcast.mapreduce.impl.task
Class TrackableJobFuture<V>

java.lang.Object
  extended by com.hazelcast.spi.impl.AbstractCompletableFuture<V>
      extended by com.hazelcast.mapreduce.impl.task.TrackableJobFuture<V>
Type Parameters:
V - type of the resulting value
All Implemented Interfaces:
ICompletableFuture<V>, JobCompletableFuture<V>, TrackableJob<V>, Future<V>

public class TrackableJobFuture<V>
extends AbstractCompletableFuture<V>
implements TrackableJob<V>, JobCompletableFuture<V>

This is the node based implementation of the job's reactive ICompletableFuture and is returned to the users codebase. It hides the exposed JobPartitionState array from JobProcessInformationImpl by wrapping it into an adapter that creates a full copy prior to returning it to the end user.


Field Summary
 
Fields inherited from class com.hazelcast.spi.impl.AbstractCompletableFuture
nodeEngine, NULL_VALUE, result, resultUpdater
 
Constructor Summary
TrackableJobFuture(String name, String jobId, JobTracker jobTracker, NodeEngine nodeEngine, Collator collator)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 V get(long timeout, TimeUnit unit)
           
 ICompletableFuture<V> getCompletableFuture()
          Returns the ICompletableFuture to add callbacks or wait for the resulting value of the tracked job
 String getJobId()
          Returns the unique job id of the tracked job
 JobProcessInformation getJobProcessInformation()
          Returns an instance of JobProcessInformation to find out the state and statistics of a running task or null if the underlying job id is not available because job is already finished or not yet submitted.
It even returns null if not requested on the job issuing cluster member or client since those values are not distributed to all clusters for traffic reasons.
 JobTracker getJobTracker()
          Returns the assigned JobTracker
 String getName()
          Returns the name of the underlying JobTracker
 boolean isCancelled()
           
 void setResult(Object result)
           
 
Methods inherited from class com.hazelcast.spi.impl.AbstractCompletableFuture
andThen, andThen, fireCallbacks, get, getAsyncExecutor, getResult, isDone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.ICompletableFuture
andThen, andThen
 
Methods inherited from interface java.util.concurrent.Future
get, isDone
 

Constructor Detail

TrackableJobFuture

public TrackableJobFuture(String name,
                          String jobId,
                          JobTracker jobTracker,
                          NodeEngine nodeEngine,
                          Collator collator)
Method Detail

setResult

public void setResult(Object result)
Overrides:
setResult in class AbstractCompletableFuture<V>

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<V>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<V>

get

public V get(long timeout,
             TimeUnit unit)
      throws InterruptedException,
             ExecutionException,
             TimeoutException
Specified by:
get in interface Future<V>
Throws:
InterruptedException
ExecutionException
TimeoutException

getJobTracker

public JobTracker getJobTracker()
Description copied from interface: TrackableJob
Returns the assigned JobTracker

Specified by:
getJobTracker in interface TrackableJob<V>
Returns:
assigned JobTracker

getName

public String getName()
Description copied from interface: TrackableJob
Returns the name of the underlying JobTracker

Specified by:
getName in interface TrackableJob<V>
Returns:
name of the JobTracker

getJobId

public String getJobId()
Description copied from interface: TrackableJob
Returns the unique job id of the tracked job

Specified by:
getJobId in interface JobCompletableFuture<V>
Specified by:
getJobId in interface TrackableJob<V>
Returns:
job id of the tracked job

getCompletableFuture

public ICompletableFuture<V> getCompletableFuture()
Description copied from interface: TrackableJob
Returns the ICompletableFuture to add callbacks or wait for the resulting value of the tracked job

Specified by:
getCompletableFuture in interface TrackableJob<V>
Returns:
ICompletableFuture of the tracked job

getJobProcessInformation

public JobProcessInformation getJobProcessInformation()
Description copied from interface: TrackableJob
Returns an instance of JobProcessInformation to find out the state and statistics of a running task or null if the underlying job id is not available because job is already finished or not yet submitted.
It even returns null if not requested on the job issuing cluster member or client since those values are not distributed to all clusters for traffic reasons.

Specified by:
getJobProcessInformation in interface TrackableJob<V>
Returns:
instance of the jobs process information or null if job id is not available


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.