com.hazelcast.core
Class DistributedTask<V>

java.lang.Object
  extended by java.util.concurrent.FutureTask<V>
      extended by com.hazelcast.core.DistributedTask<V>
All Implemented Interfaces:
Runnable, Future<V>, RunnableFuture<V>
Direct Known Subclasses:
MultiTask

public class DistributedTask<V>
extends FutureTask<V>

A cancellable asynchronous distributed computation.

This class is analogue to java.util.concurrent.FutureTask.

Once the computation has completed, the computation cannot be restarted or cancelled.


Nested Class Summary
static class DistributedTask.DistributedRunnableAdapterImpl<V>
           
protected  class DistributedTask.Inner
           
 
Constructor Summary
  DistributedTask(Callable<V> callable)
           
  DistributedTask(Callable<V> callable, Member member)
           
  DistributedTask(Callable<V> callable, Object key)
           
protected DistributedTask(Callable<V> callable, Set<Member> members)
           
  DistributedTask(Runnable task, V result)
           
 
Method Summary
static
<V> Callable<V>
callable(Runnable task, V result)
           
 boolean cancel(boolean mayInterruptIfRunning)
           
 V get()
           
 V get(long timeout, TimeUnit unit)
           
 ExecutionCallback<V> getExecutionCallback()
           
 Object getInner()
           
 boolean isCancelled()
           
 boolean isDone()
           
protected  void onResult(V result)
           
protected  void set(V value)
           
 void setExecutionCallback(ExecutionCallback<V> executionCallback)
           
protected  void setMemberLeft(Member member)
           
 
Methods inherited from class java.util.concurrent.FutureTask
done, run, runAndReset, setException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistributedTask

public DistributedTask(Callable<V> callable)

DistributedTask

public DistributedTask(Callable<V> callable,
                       Member member)

DistributedTask

protected DistributedTask(Callable<V> callable,
                          Set<Member> members)

DistributedTask

public DistributedTask(Callable<V> callable,
                       Object key)

DistributedTask

public DistributedTask(Runnable task,
                       V result)
Method Detail

get

public V get()
      throws InterruptedException,
             ExecutionException
Specified by:
get in interface Future<V>
Overrides:
get in class FutureTask<V>
Throws:
InterruptedException
ExecutionException

get

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

set

protected void set(V value)
Overrides:
set in class FutureTask<V>

setExecutionCallback

public void setExecutionCallback(ExecutionCallback<V> executionCallback)

getExecutionCallback

public ExecutionCallback<V> getExecutionCallback()

isCancelled

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

isDone

public boolean isDone()
Specified by:
isDone in interface Future<V>
Overrides:
isDone in class FutureTask<V>

cancel

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

setMemberLeft

protected void setMemberLeft(Member member)

getInner

public Object getInner()

callable

public static <V> Callable<V> callable(Runnable task,
                                       V result)

onResult

protected void onResult(V result)


Copyright © 2008-2012 Hazel Ltd. All Rights Reserved.