GigaSpaces XAP 7.0 API

org.openspaces.core.executor.support
Class MinTask<T extends Number>

java.lang.Object
  extended by org.openspaces.core.executor.support.SimpleDelegatingTask<T>
      extended by org.openspaces.core.executor.support.AbstractDelegatingDistributedTask<T,T>
          extended by org.openspaces.core.executor.support.MinTask<T>
All Implemented Interfaces:
AsyncResultFilter<T>, AsyncResultsReducer<T,T>, Externalizable, Serializable, DistributedTask<T,T>, DelegatingTask<T>, Task<T>, TaskRoutingProvider

public class MinTask<T extends Number>
extends AbstractDelegatingDistributedTask<T,T>
implements Externalizable

A min distrubted task that accepts a 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.

Author:
kimchy
See Also:
MaxReducer, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.gigaspaces.async.AsyncResultFilter
AsyncResultFilter.Decision
 
Constructor Summary
MinTask()
           
MinTask(Class<T> reduceType, Task<T> task)
          Constructs a new sum distributed task that delegates the actual execution to th provided task.
MinTask(Class<T> reduceType, Task<T> task, AsyncResultFilter<T> filter)
          Constructs a new sum distributed task that delegates the actual execution to th provided task.
 
Method Summary
 MinTask ignoreExceptions()
          Sests the reduce(java.util.List) to ignore failed invocations.
 void readExternal(ObjectInput in)
           
 T reduce(List<AsyncResult<T>> results)
          Performs the actual sum operation by delegating to its internal SumReducer.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.openspaces.core.executor.support.AbstractDelegatingDistributedTask
_readExternal, _writeExternal, getFilter, onResult
 
Methods inherited from class org.openspaces.core.executor.support.SimpleDelegatingTask
execute, getDelegatedTask, getRouting
 
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
 

Constructor Detail

MinTask

public MinTask()

MinTask

public MinTask(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

MinTask

public MinTask(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
Method Detail

ignoreExceptions

public MinTask ignoreExceptions()
Sests 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

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.