Package org.openspaces.core.executor.juc
Class CallableDistributedTaskAdapter<T extends Serializable,R>
java.lang.Object
org.openspaces.core.executor.juc.CallableTaskAdapter<T>
org.openspaces.core.executor.juc.CallableDistributedTaskAdapter<T,R>
- All Implemented Interfaces:
AsyncResultFilter<T>,AsyncResultsReducer<T,,R> SmartExternalizable,Externalizable,Serializable,DistributedTask<T,,R> ProcessObjectsProvider,Task<T>,TaskRoutingProvider
public class CallableDistributedTaskAdapter<T extends Serializable,R>
extends CallableTaskAdapter<T>
implements DistributedTask<T,R>, AsyncResultFilter<T>
An adapter allowing to execute a
Callable 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 com.gigaspaces.async.AsyncResultFilter
AsyncResultFilter.Decision -
Constructor Summary
ConstructorsConstructorDescriptionHere just for externalizable.CallableDistributedTaskAdapter(Callable<T> callable) Constructs a new callable distributed task adapter.CallableDistributedTaskAdapter(Callable<T> callable, AsyncResultsReducer<T, R> reducer) Constructs a new callable distributed task adapter with a separate reducer.CallableDistributedTaskAdapter(Callable<T> callable, AsyncResultsReducer<T, R> reducer, AsyncResultFilter<T> filter) Constructs a new callable 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 org.openspaces.core.executor.juc.CallableTaskAdapter
execute, getCallable, getObjectsToProcess, getRoutingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.gigaspaces.serialization.SmartExternalizable
enabledSmartExternalizableWithReference
-
Constructor Details
-
CallableDistributedTaskAdapter
public CallableDistributedTaskAdapter()Here just for externalizable. -
CallableDistributedTaskAdapter
Constructs a new callable distributed task adapter. The callable in this case must implements {link AsyncResultReducer} and optionally can implementAsyncResultFilter.- Throws:
IllegalArgumentException
-
CallableDistributedTaskAdapter
public CallableDistributedTaskAdapter(Callable<T> callable, AsyncResultsReducer<T, R> reducer) throws IllegalArgumentExceptionConstructs a new callable distributed task adapter with a separate reducer. The reducer or the callable can optionally implementAsyncResultFilter.- Throws:
IllegalArgumentException
-
CallableDistributedTaskAdapter
public CallableDistributedTaskAdapter(Callable<T> callable, AsyncResultsReducer<T, R> reducer, AsyncResultFilter<T> filter) throws IllegalArgumentExceptionConstructs a new callable 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 classCallableTaskAdapter<T extends Serializable>- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classCallableTaskAdapter<T extends Serializable>- Throws:
IOExceptionClassNotFoundException
-