Package org.openspaces.core.executor.juc
Class RunnableTaskAdapter<T extends Serializable>
java.lang.Object
org.openspaces.core.executor.juc.RunnableTaskAdapter<T>
- All Implemented Interfaces:
SmartExternalizable,Externalizable,Serializable,ProcessObjectsProvider,Task<T>,TaskRoutingProvider
- Direct Known Subclasses:
RunnableDistributedTaskAdapter
public class RunnableTaskAdapter<T extends Serializable>
extends Object
implements Task<T>, ProcessObjectsProvider, TaskRoutingProvider, SmartExternalizable
An adapter allowing to execute a
Runnable using Space task executors.- Author:
- kimchy
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHere just for externlizable.RunnableTaskAdapter(Runnable runnable) Constructs a new runnable task adapter with the runnable torun.RunnableTaskAdapter(Runnable runnable, T result) Constructs a new runnable task adapter with the runnable torun. -
Method Summary
Modifier and TypeMethodDescriptionexecute()Simply delegates the execution toRunnable.run()and returns the optional result provided in the constructor.Object[]Returns the callable passed so it will be processed on the node it is executed on as well.Tries to extract the routing information form the task.protected RunnableReturns the embedded runnable.voidvoidMethods 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
-
RunnableTaskAdapter
public RunnableTaskAdapter()Here just for externlizable. -
RunnableTaskAdapter
Constructs a new runnable task adapter with the runnable torun. -
RunnableTaskAdapter
Constructs a new runnable task adapter with the runnable torun. Will return the result after the call torun.
-
-
Method Details
-
execute
Simply delegates the execution toRunnable.run()and returns the optional result provided in the constructor.- Specified by:
executein interfaceTask<T extends Serializable>- Returns:
- computed result
- Throws:
Exception- if unable to compute a result
-
getObjectsToProcess
Returns the callable passed so it will be processed on the node it is executed on as well.- Specified by:
getObjectsToProcessin interfaceProcessObjectsProvider
-
getRouting
Tries to extract the routing information form the task.- Specified by:
getRoutingin interfaceTaskRoutingProvider
-
getRunnable
Returns the embedded runnable. -
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-