GigaSpaces XAP 7.0 API

org.openspaces.core.executor.juc
Class CallableTaskAdapter<T extends Serializable>

java.lang.Object
  extended by org.openspaces.core.executor.juc.CallableTaskAdapter<T>
All Implemented Interfaces:
Externalizable, Serializable, ProcessObjectsProvider, Task<T>, TaskRoutingProvider
Direct Known Subclasses:
CallableDistributedTaskAdapter

public class CallableTaskAdapter<T extends Serializable>
extends Object
implements Task<T>, ProcessObjectsProvider, TaskRoutingProvider, Externalizable

An adapter allowing to execute a Callable using Space task executors.

Author:
kimchy
See Also:
Serialized Form

Constructor Summary
CallableTaskAdapter()
          Here just for externalizable.
CallableTaskAdapter(Callable<T> callable)
          Constructs a new callable task adapter with the callable to call.
 
Method Summary
 T execute()
          Simply delegates the execution to Callable.call().
protected  Callable<T> getCallable()
          Returns the embedded callable.
 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.
 void readExternal(ObjectInput in)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallableTaskAdapter

public CallableTaskAdapter()
Here just for externalizable.


CallableTaskAdapter

public CallableTaskAdapter(Callable<T> callable)
Constructs a new callable task adapter with the callable to call.

Method Detail

execute

public T execute()
                               throws Exception
Simply delegates the execution to Callable.call().

Specified by:
execute in interface Task<T extends Serializable>
Returns:
computed result
Throws:
Exception - if unable to compute a result

getObjectsToProcess

public Object[] getObjectsToProcess()
Returns the callable passed so it will be processed on the node it is executed on as well.

Specified by:
getObjectsToProcess in interface ProcessObjectsProvider

getRouting

public Object getRouting()
Tries to extract the routing information form the task.

Specified by:
getRouting in interface TaskRoutingProvider

getCallable

protected Callable<T> getCallable()
Returns the embedded callable.


writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.