GigaSpaces XAP 9.7.2 API

org.openspaces.core.executor.juc
Class RunnableDistributedTaskAdapter<T extends Serializable,R>

java.lang.Object
  extended by org.openspaces.core.executor.juc.RunnableTaskAdapter<T>
      extended by org.openspaces.core.executor.juc.RunnableDistributedTaskAdapter<T,R>
All Implemented Interfaces:
AsyncResultFilter<T>, AsyncResultsReducer<T,R>, Externalizable, Serializable, DistributedTask<T,R>, ProcessObjectsProvider, Task<T>, TaskRoutingProvider

public class RunnableDistributedTaskAdapter<T extends Serializable,R>
extends RunnableTaskAdapter<T>
implements DistributedTask<T,R>, AsyncResultFilter<T>

An adapter allowing to execute a Runnable in a distributed fashion. In such a case, a AsyncResultsReducer must be implemented or provided (see the different constructors). An optional AsyncResultFilter can be also implemented or provided.

Author:
kimchy
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.gigaspaces.async.AsyncResultFilter
AsyncResultFilter.Decision
 
Constructor Summary
RunnableDistributedTaskAdapter()
          Here just for externalizable.
RunnableDistributedTaskAdapter(Runnable runnable)
          Constructs a new runnable distributed task adapter.
RunnableDistributedTaskAdapter(Runnable runnable, AsyncResultsReducer<T,R> reducer)
          Constructs a new runnable distributed task adapter with a separate reducer.
RunnableDistributedTaskAdapter(Runnable runnable, AsyncResultsReducer<T,R> reducer, AsyncResultFilter<T> filter)
          Constructs a new runnable distributed task adapter with a separate reducer and filter.
RunnableDistributedTaskAdapter(Runnable runnable, T result)
          Constructs a new runnable distributed task adapter.
RunnableDistributedTaskAdapter(Runnable runnable, T result, AsyncResultsReducer<T,R> reducer)
          Constructs a new runnable distributed task adapter with a separate reducer.
RunnableDistributedTaskAdapter(Runnable runnable, T result, AsyncResultsReducer<T,R> reducer, AsyncResultFilter<T> filter)
          Constructs a new runnable distributed task adapter with a separate reducer and filter.
 
Method Summary
 AsyncResultFilter.Decision onResult(AsyncResultFilterEvent<T> event)
          If a filter is provided in one of the constructor methods, will delegate the call to it.
 void readExternal(ObjectInput in)
           
 R reduce(List<AsyncResult<T>> results)
          Delegates the call to the provided reducer.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.openspaces.core.executor.juc.RunnableTaskAdapter
execute, getObjectsToProcess, getRouting, getRunnable
 
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

RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter()
Here just for externalizable.


RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter(Runnable runnable)
                               throws IllegalArgumentException
Constructs a new runnable distributed task adapter. The runnable in this case must implements {link AsyncResultReducer} and optionally can implement AsyncResultFilter.

Throws:
IllegalArgumentException

RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter(Runnable runnable,
                                      T result)
Constructs a new runnable distributed task adapter. The runnable in this case must implements {link AsyncResultReducer} and optionally can implement AsyncResultFilter.


RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter(Runnable runnable,
                                      AsyncResultsReducer<T,R> reducer)
                               throws IllegalArgumentException
Constructs a new runnable distributed task adapter with a separate reducer. The reducer or the runnable can optionally implement AsyncResultFilter.

Throws:
IllegalArgumentException

RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter(Runnable runnable,
                                      T result,
                                      AsyncResultsReducer<T,R> reducer)
                               throws IllegalArgumentException
Constructs a new runnable distributed task adapter with a separate reducer. The reducer or the runnable can optionally implement AsyncResultFilter.

Throws:
IllegalArgumentException

RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter(Runnable runnable,
                                      AsyncResultsReducer<T,R> reducer,
                                      AsyncResultFilter<T> filter)
                               throws IllegalArgumentException
Constructs a new runnable distributed task adapter with a separate reducer and filter.

Throws:
IllegalArgumentException

RunnableDistributedTaskAdapter

public RunnableDistributedTaskAdapter(Runnable runnable,
                                      T result,
                                      AsyncResultsReducer<T,R> reducer,
                                      AsyncResultFilter<T> filter)
                               throws IllegalArgumentException
Constructs a new runnable distributed task adapter with a separate reducer and filter.

Throws:
IllegalArgumentException
Method Detail

reduce

public R reduce(List<AsyncResult<T>> results)
         throws Exception
Delegates the call to the provided reducer.

Specified by:
reduce in interface AsyncResultsReducer<T extends Serializable,R>
Throws:
Exception

onResult

public AsyncResultFilter.Decision onResult(AsyncResultFilterEvent<T> event)
If a filter is provided in one of the constructor methods, will delegate the call to it. Otherwise it will return the default AsyncResultFilter.Decision.CONTINUE.

Specified by:
onResult in interface AsyncResultFilter<T extends Serializable>

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class RunnableTaskAdapter<T extends Serializable>
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class RunnableTaskAdapter<T extends Serializable>
Throws:
IOException
ClassNotFoundException

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.