GigaSpaces XAP 10.0.1 API

org.openspaces.core
Class ExecutorBuilder<T extends Serializable,R>

java.lang.Object
  extended by org.openspaces.core.ExecutorBuilder<T,R>

public class ExecutorBuilder<T extends Serializable,R>
extends Object

The executor builder allows to combine all the different types of executing tasks into a single execution (of course, the execution itself, of all the tasks, is asynchronous). Similar to map reduce where first all the tasks are defined, and then executed, and later on, reduced.

Author:
kimchy
See Also:
GigaSpace.executorBuilder(com.gigaspaces.async.AsyncResultsReducer)

Method Summary
 ExecutorBuilder<T,R> add(DistributedTask<T,R> task)
          Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.DistributedTask)
 ExecutorBuilder<T,R> add(DistributedTask<T,R> task, Object... routing)
          Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.DistributedTask, Object[])
 ExecutorBuilder<T,R> add(Task<T> task)
          Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.Task).
 ExecutorBuilder<T,R> add(Task<T> task, AsyncFutureListener<T> listener)
          Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.Task).
 ExecutorBuilder<T,R> add(Task<T> task, Object routing)
          Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.Task, Object).
 AsyncFuture<R> execute()
          Executes all the given tasks (asynchronously) based on their execution mode and returns a future allowing to retrieve the reduced operation of all the tasks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public ExecutorBuilder<T,R> add(Task<T> task)
Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.Task).

Parameters:
task - The task to add
Returns:
The executor builder to add more tasks to or execute().
See Also:
GigaSpace.execute(org.openspaces.core.executor.Task)

add

public ExecutorBuilder<T,R> add(Task<T> task,
                                AsyncFutureListener<T> listener)
Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.Task).

Parameters:
task - The task to add
Returns:
The executor builder to add more tasks to or execute().
See Also:
GigaSpace.execute(org.openspaces.core.executor.Task)

add

public ExecutorBuilder<T,R> add(Task<T> task,
                                Object routing)
Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.Task, Object).

Parameters:
task - The task to add
Returns:
The executor builder to add more tasks to or execute().
See Also:
GigaSpace.execute(org.openspaces.core.executor.Task, Object)

add

public ExecutorBuilder<T,R> add(DistributedTask<T,R> task,
                                Object... routing)
Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.DistributedTask, Object[])

Parameters:
task - The task to add
Returns:
The executor builder to add more tasks to or execute().
See Also:
GigaSpace.execute(org.openspaces.core.executor.DistributedTask, Object[])

add

public ExecutorBuilder<T,R> add(DistributedTask<T,R> task)
Adds a task to be executed similarly to GigaSpace.execute(org.openspaces.core.executor.DistributedTask)

Parameters:
task - The task to add
Returns:
The executor builder to add more tasks to or execute().
See Also:
GigaSpace.execute(org.openspaces.core.executor.DistributedTask)

execute

public AsyncFuture<R> execute()
Executes all the given tasks (asynchronously) based on their execution mode and returns a future allowing to retrieve the reduced operation of all the tasks.

The future actual result will be the reduced result of the execution, or the exception thrown during during the reduce operation. The moderator (assuming the reducer provided implements AsyncResultFilter) can be used as a mechanism to listen for results as they arrive.

Returns:
a Future representing pending completion of the task, and whose get() method will return the task value upon completion.

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.