org.openspaces.core.executor.support
Class MaxTask<T extends Number>
java.lang.Object
org.openspaces.core.executor.support.SimpleDelegatingTask<T>
org.openspaces.core.executor.support.AbstractDelegatingDistributedTask<T,T>
org.openspaces.core.executor.support.MaxTask<T>
- All Implemented Interfaces:
- AsyncResultFilter<T>, AsyncResultsReducer<T,T>, Externalizable, Serializable, DistributedTask<T,T>, DelegatingTask<T>, Task<T>, TaskRoutingProvider
public class MaxTask<T extends Number>
- extends AbstractDelegatingDistributedTask<T,T>
- implements Externalizable
A max distrubuted task that accepts a Task
to delegate
the actual execution to and implements the reduce(java.util.List)
operation.
By default, 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 optional AsyncResultFilter
.
- Author:
- kimchy
- See Also:
MaxReducer
,
Serialized Form
Constructor Summary |
MaxTask()
|
MaxTask(Class<T> reduceType,
Task<T> task)
Constructs a new sum distributed task that delegates the actual execution to
th provided task. |
MaxTask(Class<T> reduceType,
Task<T> task,
AsyncResultFilter<T> filter)
Constructs a new sum distributed task that delegates the actual execution to
th provided task. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.openspaces.core.executor.Task |
execute |
MaxTask
public MaxTask()
MaxTask
public MaxTask(Class<T> reduceType,
Task<T> task)
throws IllegalArgumentException
- Constructs a new sum distributed task that delegates the actual execution to
th provided task.
- Parameters:
task
- The task to delegate the execution to.
- Throws:
IllegalArgumentException
MaxTask
public MaxTask(Class<T> reduceType,
Task<T> task,
AsyncResultFilter<T> filter)
throws IllegalArgumentException
- Constructs a new sum distributed task that delegates the actual execution to
th provided task.
- Parameters:
task
- The task to delegate the execution to.filter
- A result filter to be called for each result
- Throws:
IllegalArgumentException
ignoreExceptions
public MaxTask ignoreExceptions()
- Sets the
reduce(java.util.List)
to ignore failed invocations.
reduce
public T reduce(List<AsyncResult<T>> results)
throws Exception
- Performs the actual sum operation by delegating to its internal
SumReducer
.
- Specified by:
reduce
in interface AsyncResultsReducer<T extends Number,T extends Number>
- Throws:
Exception
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
- Specified by:
writeExternal
in interface Externalizable
- Throws:
IOException
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
- Specified by:
readExternal
in interface Externalizable
- Throws:
IOException
ClassNotFoundException
Copyright © GigaSpaces.