GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid.lang
Class GridAbsClosure

java.lang.Object
  extended by org.gridgain.grid.lang.GridMetadataAwareAdapter
      extended by org.gridgain.grid.lang.GridLambdaAdapter
          extended by org.gridgain.grid.lang.GridAbsClosure
All Implemented Interfaces:
Serializable, Cloneable, Runnable, GridJob, GridMetadataAware, GridPeerDeployAware, GridLambda
Direct Known Subclasses:
CA, GridAbsClosureX

public abstract class GridAbsClosure
extends GridLambdaAdapter
implements Runnable, GridJob

Defines a convenient absolute, i.e. no-arg and no return value closure. This closure that has void return type and no arguments (free variables).

Thread Safety

Note that this interface does not impose or assume any specific thread-safety by its implementations. Each implementation can elect what type of thread-safety it provides, if any.

Note that this class implements GridJob interface for convenience and can be used in GridTask implementations directly, if needed, as an alternative to GridJobAdapterEx.

Wiki & Forum:


Wiki
Forum

See Also:
GridFunc, Serialized Form
 

Constructor Summary
GridAbsClosure()
           
 
Method Summary
abstract  void apply()
          Absolute closure body.
 void cancel()
          Does nothing by default.
 Object execute()
          Delegates to GridAbsClosure.apply() method.
 void run()
          Delegates to GridAbsClosure.apply() method.
<E> GridInClosure<E>
uncurry()
          Gets closure that ignores its argument and executes the same way as this absolute closure.
<E1,E2> GridInClosure2<E1,E2>
uncurry2()
          Gets closure that ignores its arguments and executes the same way as this absolute closure.
<E1,E2,E3> GridInClosure3<E1,E2,E3>
uncurry3()
          Gets closure that ignores its arguments and executes the same way as this absolute closure.
 
Methods inherited from class org.gridgain.grid.lang.GridLambdaAdapter
classLoader, deployClass, peerDeployLike, withMeta
 
Methods inherited from class org.gridgain.grid.lang.GridMetadataAwareAdapter
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, readExternalMeta, removeMeta, removeMeta, replaceMeta, writeExternalMeta
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gridgain.grid.GridMetadataAware
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta
 

Constructor Detail

GridAbsClosure

public GridAbsClosure()
Method Detail

apply

public abstract void apply()
Absolute closure body.


run

public final void run()
Delegates to GridAbsClosure.apply() method.

Specified by:
run in interface Runnable

cancel

public void cancel()
Does nothing by default. Child classes may override this method to provide implementation-specific cancellation logic.

Note that this method is here only to support GridJob interface and only makes sense whenever this class is used as grid job or is executed via any of GridProjection methods.

This method is called when when system detects that completion of this job can no longer alter the overall outcome (for example, when parent task has already reduced the results). Job is also cancelled when GridFuture.cancel() is called.

Note that job cancellation is only a hint, and just like with Thread.interrupt() method, it is really up to the actual job instance to gracefully finish execution and exit.

Specified by:
cancel in interface GridJob

uncurry

public <E> GridInClosure<E> uncurry()
Gets closure that ignores its argument and executes the same way as this absolute closure.

Type Parameters:
E - Type of ignore argument.
Returns:
Closure that ignores its argument and executes the same way as this absolute closure.

uncurry2

public <E1,E2> GridInClosure2<E1,E2> uncurry2()
Gets closure that ignores its arguments and executes the same way as this absolute closure.

Type Parameters:
E1 - Type of 1st ignore argument.
E2 - Type of 2nd ignore argument.
Returns:
Closure that ignores its arguments and executes the same way as this absolute closure.

uncurry3

public <E1,E2,E3> GridInClosure3<E1,E2,E3> uncurry3()
Gets closure that ignores its arguments and executes the same way as this absolute closure.

Type Parameters:
E1 - Type of 1st ignore argument.
E2 - Type of 2nd ignore argument.
E3 - Type of 3d ignore argument.
Returns:
Closure that ignores its arguments and executes the same way as this absolute closure.

execute

public final Object execute()
                     throws GridException
Delegates to GridAbsClosure.apply() method.

Executes this job.

Specified by:
execute in interface GridJob
Throws:
GridException - If job execution caused an exception. This exception will be returned in GridJobResult.getException() method passed into GridTask.result(GridJobResult, List) method into task on caller node. If execution produces a RuntimeException or Error, then it will be wrapped into GridException.
Returns:
Job execution result (possibly null). This result will be returned in GridJobResult.getData() method passed into GridTask.result(GridJobResult, List) method into task on caller node.

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube