public class AvgTask<T extends Number,R extends Number> extends AbstractDelegatingDistributedTask<T,R> implements Externalizable
Task
to delegate
the actual execution to and implements the reduce(java.util.List)
operation.
By defualt, throws an exception if one of the execution fails. ignoreExceptions()
can be called to only perform the operation on all the successful operations, ignoring the failed
ones.
Can accept an optioanl AsyncResultFilter
.
SumReducer
,
Serialized FormAsyncResultFilter.Decision
Constructor and Description |
---|
AvgTask()
Here for externalizable.
|
AvgTask(Class<R> reduceType,
Task<T> task)
Constructs a new sum distributed task that delegates the actual execution to
th provided task.
|
AvgTask(Class<R> reduceType,
Task<T> task,
AsyncResultFilter<T> filter)
Constructs a new sum distributed task that delegates the actual execution to
th provided task.
|
Modifier and Type | Method and Description |
---|---|
AvgTask |
ignoreExceptions()
Sests the
reduce(java.util.List) to ignore failed invocations. |
void |
readExternal(ObjectInput in) |
R |
reduce(List<AsyncResult<T>> results)
Performs the actual sum operation by delegating to its internal
SumReducer . |
void |
writeExternal(ObjectOutput out) |
_readExternal, _writeExternal, getFilter, onResult
execute, getDelegatedTask, getRouting
public AvgTask()
public AvgTask(Class<R> reduceType, Task<T> task) throws IllegalArgumentException
task
- The task to delegate the execution to.IllegalArgumentException
public AvgTask(Class<R> reduceType, Task<T> task, AsyncResultFilter<T> filter) throws IllegalArgumentException
task
- The task to delegate the execution to.filter
- A result filter to be called for each resultIllegalArgumentException
public AvgTask ignoreExceptions()
reduce(java.util.List)
to ignore failed invocations.public R reduce(List<AsyncResult<T>> results) throws Exception
SumReducer
.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © GigaSpaces.