Class RunnableDistributedTaskAdapter<T extends Serializable, R>
java.lang.Object
org.openspaces.core.executor.juc.RunnableTaskAdapter<T>
org.openspaces.core.executor.juc.RunnableDistributedTaskAdapter<T,R>
- All Implemented Interfaces:
AsyncResultFilter<T>, AsyncResultsReducer<T,R>, SmartExternalizable, 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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface AsyncResultFilter
AsyncResultFilter.Decision -
Constructor Summary
ConstructorsConstructorDescriptionHere 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
Modifier and TypeMethodDescriptiononResult(AsyncResultFilterEvent<T> event) If a filter is provided in one of the constructor methods, will delegate the call to it.voidreduce(List<AsyncResult<T>> results) Delegates the call to the provided reducer.voidMethods inherited from class RunnableTaskAdapter
execute, getObjectsToProcess, getRouting, getRunnableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SmartExternalizable
enabledSmartExternalizableWithReference
-
Constructor Details
-
RunnableDistributedTaskAdapter
public RunnableDistributedTaskAdapter()Here just for externalizable. -
RunnableDistributedTaskAdapter
Constructs a new runnable distributed task adapter. The runnable in this case must implements {link AsyncResultReducer} and optionally can implementAsyncResultFilter.- Throws:
IllegalArgumentException
-
RunnableDistributedTaskAdapter
Constructs a new runnable distributed task adapter. The runnable in this case must implements {link AsyncResultReducer} and optionally can implementAsyncResultFilter. -
RunnableDistributedTaskAdapter
public RunnableDistributedTaskAdapter(Runnable runnable, AsyncResultsReducer<T, R> reducer) throws IllegalArgumentExceptionConstructs a new runnable distributed task adapter with a separate reducer. The reducer or the runnable can optionally implementAsyncResultFilter.- Throws:
IllegalArgumentException
-
RunnableDistributedTaskAdapter
public RunnableDistributedTaskAdapter(Runnable runnable, T result, AsyncResultsReducer<T, R> reducer) throws IllegalArgumentExceptionConstructs a new runnable distributed task adapter with a separate reducer. The reducer or the runnable can optionally implementAsyncResultFilter.- Throws:
IllegalArgumentException
-
RunnableDistributedTaskAdapter
public RunnableDistributedTaskAdapter(Runnable runnable, AsyncResultsReducer<T, R> reducer, AsyncResultFilter<T> filter) throws IllegalArgumentExceptionConstructs 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 IllegalArgumentExceptionConstructs a new runnable distributed task adapter with a separate reducer and filter.- Throws:
IllegalArgumentException
-
-
Method Details
-
reduce
Delegates the call to the provided reducer.- Specified by:
reducein interfaceAsyncResultsReducer<T extends Serializable, R>- Throws:
Exception
-
onResult
If a filter is provided in one of the constructor methods, will delegate the call to it. Otherwise it will return the defaultAsyncResultFilter.Decision.CONTINUE.- Specified by:
onResultin interfaceAsyncResultFilter<T extends Serializable>
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classRunnableTaskAdapter<T extends Serializable>- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classRunnableTaskAdapter<T extends Serializable>- Throws:
IOExceptionClassNotFoundException
-