public class RunnableTaskAdapter<T extends Serializable> extends Object implements Task<T>, ProcessObjectsProvider, TaskRoutingProvider, SmartExternalizable
Runnable
using Space task executors.Constructor and Description |
---|
RunnableTaskAdapter()
Here just for externlizable.
|
RunnableTaskAdapter(Runnable runnable)
Constructs a new runnable task adapter with the runnable to
run . |
RunnableTaskAdapter(Runnable runnable,
T result)
Constructs a new runnable task adapter with the runnable to
run . |
Modifier and Type | Method and Description |
---|---|
T |
execute()
Simply delegates the execution to
Runnable.run() and returns the optional result
provided in the constructor. |
Object[] |
getObjectsToProcess()
Returns the callable passed so it will be processed on the node it is executed on as well.
|
Object |
getRouting()
Tries to extract the routing information form the task.
|
protected Runnable |
getRunnable()
Returns the embedded runnable.
|
void |
readExternal(ObjectInput in) |
void |
writeExternal(ObjectOutput out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
enabledSmartExternalizableWithReference
public RunnableTaskAdapter()
public RunnableTaskAdapter(Runnable runnable)
run
.public T execute() throws Exception
Runnable.run()
and returns the optional result
provided in the constructor.execute
in interface Task<T extends Serializable>
Exception
- if unable to compute a resultpublic Object[] getObjectsToProcess()
getObjectsToProcess
in interface ProcessObjectsProvider
public Object getRouting()
getRouting
in interface TaskRoutingProvider
protected Runnable getRunnable()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © GigaSpaces.