water
Class DTask<T extends DTask>

java.lang.Object
  extended by jsr166y.ForkJoinTask<java.lang.Void>
      extended by jsr166y.CountedCompleter
          extended by water.H2O.H2OCountedCompleter
              extended by water.DTask<T>
All Implemented Interfaces:
java.io.Serializable, java.util.concurrent.Future<java.lang.Void>, Freezable
Direct Known Subclasses:
Atomic, DRemoteTask, FetchClazz, FetchId, MRTask2, NOPTask, PersistHdfsTask, TaskGetKey, TaskPutKey

public abstract class DTask<T extends DTask>
extends H2O.H2OCountedCompleter
implements Freezable

Objects which are passed & remotely executed.

Efficient serialization methods for subclasses will be automatically generated, but explicit ones can be provided. Transient fields will not be mirrored between the VMs.

  1. On the local vm, this task will be serialized and sent to a remote.
  2. On the remote, the task will be deserialized.
  3. On the remote, the #invoke(H2ONode) method will be executed.
  4. On the remote, the task will be serialized and sent to the local vm
  5. On the local vm, the task will be deserialized into the original instance
  6. On the local vm, the onAck() method will be executed.
  7. On the remote, the onAckAck() method will be executed.

See Also:
Serialized Form

Field Summary
protected  java.lang.String[] _cls
           
protected  java.lang.String _eFromNode
           
protected  java.lang.String _exception
           
protected  java.lang.String[] _fname
           
protected  int[] _lineNum
           
protected  java.lang.String _msg
           
protected  java.lang.String[] _mth
           
 
Constructor Summary
DTask()
           
 
Method Summary
 DTask clone()
           
 void copyOver(T that)
           
 void dinvoke(H2ONode sender)
          Top-level remote execution hook.
 int frozenType()
          Return the cluster-wide-unique 2-byte type ID for instances of this class
 DException.DistributedException getDException()
           
 boolean hasException()
           
 boolean logVerbose()
          Override to remove 2 lines of logging per RPC.
<F extends Freezable>
F
newInstance()
          Make a new instance of class 'this' with the empty constructor
 void onAck()
          2nd top-level execution hook.
 void onAckAck()
          3rd top-level execution hook.
 boolean onExceptionalCompletion(java.lang.Throwable ex, jsr166y.CountedCompleter caller)
          Performs an action when method ForkJoinTask.completeExceptionally(java.lang.Throwable) is invoked or method CountedCompleter.compute() throws an exception, and this task has not otherwise already completed normally.
<F extends Freezable>
F
read(AutoBuffer bb)
          Deserialize from the AutoBuffer into a pre-existing 'this' object.
 void setException(java.lang.Throwable ex)
           
 DocGen.FieldDoc[] toDocField()
          Reflective list of fields
 AutoBuffer write(AutoBuffer bb)
          Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.
 AutoBuffer writeJSONFields(AutoBuffer bb)
          Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.
 
Methods inherited from class water.H2O.H2OCountedCompleter
compute, compute2, priority
 
Methods inherited from class jsr166y.CountedCompleter
addToPendingCount, compareAndSetPendingCount, complete, exec, getCompleter, getPendingCount, getRawResult, onCompletion, setCompleter, setPendingCount, setRawResult, tryComplete
 
Methods inherited from class jsr166y.ForkJoinTask
adapt, adapt, adapt, cancel, compareAndSetForkJoinTaskTag, completeExceptionally, fork, get, get, getException, getForkJoinTaskTag, getPool, getQueuedTaskCount, getSurplusQueuedTaskCount, helpQuiesce, inForkJoinPool, invoke, invokeAll, invokeAll, invokeAll, isCancelled, isCompletedAbnormally, isCompletedNormally, isDone, join, peekNextLocalTask, pollNextLocalTask, pollTask, quietlyComplete, quietlyInvoke, quietlyJoin, reinitialize, setForkJoinTaskTag, tryUnfork
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_exception

protected java.lang.String _exception

_msg

protected java.lang.String _msg

_eFromNode

protected java.lang.String _eFromNode

_lineNum

protected int[] _lineNum

_cls

protected java.lang.String[] _cls

_mth

protected java.lang.String[] _mth

_fname

protected java.lang.String[] _fname
Constructor Detail

DTask

public DTask()
Method Detail

setException

public void setException(java.lang.Throwable ex)

hasException

public boolean hasException()

getDException

public DException.DistributedException getDException()

dinvoke

public void dinvoke(H2ONode sender)
Top-level remote execution hook. Called on the remote.


onAck

public void onAck()
2nd top-level execution hook. After the primary task has received a result (ACK) and before we have sent an ACKACK, this method is executed on the local vm. Transients from the local vm are available here.


onAckAck

public void onAckAck()
3rd top-level execution hook. After the original vm sent an ACKACK, this method is executed on the remote. Transients from the remote vm are available here.


logVerbose

public boolean logVerbose()
Override to remove 2 lines of logging per RPC. 0.5M RPC's will lead to 1M lines of logging at about 50 bytes/line --> 50M of log file, which will swamp all other logging output.


onExceptionalCompletion

public boolean onExceptionalCompletion(java.lang.Throwable ex,
                                       jsr166y.CountedCompleter caller)
Description copied from class: jsr166y.CountedCompleter
Performs an action when method ForkJoinTask.completeExceptionally(java.lang.Throwable) is invoked or method CountedCompleter.compute() throws an exception, and this task has not otherwise already completed normally. On entry to this method, this task ForkJoinTask.isCompletedAbnormally(). The return value of this method controls further propagation: If true and this task has a completer, then this completer is also completed exceptionally. The default implementation of this method does nothing except return true.

Overrides:
onExceptionalCompletion in class jsr166y.CountedCompleter
Parameters:
ex - the exception
caller - the task invoking this method (which may be this task itself).
Returns:
true if this exception should be propagated to this tasks completer, if one exists.

write

public AutoBuffer write(AutoBuffer bb)
Description copied from interface: Freezable
Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.

Specified by:
write in interface Freezable

read

public <F extends Freezable> F read(AutoBuffer bb)
Description copied from interface: Freezable
Deserialize from the AutoBuffer into a pre-existing 'this' object.

Specified by:
read in interface Freezable

newInstance

public <F extends Freezable> F newInstance()
Description copied from interface: Freezable
Make a new instance of class 'this' with the empty constructor

Specified by:
newInstance in interface Freezable

frozenType

public int frozenType()
Description copied from interface: Freezable
Return the cluster-wide-unique 2-byte type ID for instances of this class

Specified by:
frozenType in interface Freezable

writeJSONFields

public AutoBuffer writeJSONFields(AutoBuffer bb)
Description copied from interface: Freezable
Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer. Output is legal JSON.

Specified by:
writeJSONFields in interface Freezable

toDocField

public DocGen.FieldDoc[] toDocField()
Description copied from interface: Freezable
Reflective list of fields

Specified by:
toDocField in interface Freezable

copyOver

public void copyOver(T that)

clone

public DTask clone()
Overrides:
clone in class java.lang.Object