Package org.openspaces.remoting
Class ExecutorRemotingTask<T extends Serializable>
java.lang.Object
org.openspaces.remoting.ExecutorRemotingTask<T>
- All Implemented Interfaces:
AsyncResultsReducer<ExecutorRemotingTask.InternalExecutorResult<T>,,List<AsyncResult<ExecutorRemotingTask.InternalExecutorResult<T>>>> SmartExternalizable,Externalizable,Serializable,ClusterInfoAware,DistributedTask<ExecutorRemotingTask.InternalExecutorResult<T>,,List<AsyncResult<ExecutorRemotingTask.InternalExecutorResult<T>>>> Task<ExecutorRemotingTask.InternalExecutorResult<T>>,TaskRoutingProvider,SpaceRemotingInvocation,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class ExecutorRemotingTask<T extends Serializable>
extends Object
implements DistributedTask<ExecutorRemotingTask.InternalExecutorResult<T>,List<AsyncResult<ExecutorRemotingTask.InternalExecutorResult<T>>>>, org.springframework.context.ApplicationContextAware, ClusterInfoAware, TaskRoutingProvider, SpaceRemotingInvocation, SmartExternalizable
A
Task that can be used to simulate remote invocation with
SpaceRemotingServiceExporter. When executed, the task searches
for a service exporter (first under the hardwired name serviceExporter, then any
bean that define this class), and based on parameters passed on the task itself (such as method
name, lookup name and arguments) invokes service methods that are registered with the service
exporter.- Author:
- kimchy
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA wrapper executor exception that holds more information on the exception, such as the instance id.static classA wrapper executor result that holds more information on the exception, such as the instance id. -
Constructor Summary
ConstructorsConstructorDescriptionShould not be used.ExecutorRemotingTask(String lookupName, String methodName, RemotingUtils.MethodHash methodHash, Object[] arguments) -
Method Summary
Modifier and TypeMethodDescriptionexecute()Computes a result, or throws an exception if unable to do so.Object[]The arguments for the service method execution.The lookup name of the service.Object[]Meta arguments that can be passed as part of the invocation.The method name of the service that will be executed.Returns the routing of the task.static SpaceRemotingServiceExportergetServiceExporter(org.springframework.context.ApplicationContext applicationContext) voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetClusterInfo(ClusterInfo clusterInfo) Sets the cluster information.voidsetServiceExporter(SpaceRemotingServiceExporter serviceExporter) voidMethods 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
-
ExecutorRemotingTask
public ExecutorRemotingTask()Should not be used. Used for externalizable. -
ExecutorRemotingTask
public ExecutorRemotingTask(String lookupName, String methodName, RemotingUtils.MethodHash methodHash, Object[] arguments)
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
setClusterInfo
Description copied from interface:ClusterInfoAwareSets the cluster information.Note, the cluster information is obtained externally from the application context which means that this feature need to be supported by specific containers (and is not supported by plain Spring application context). This means that beans that implement
ClusterInfoAwareshould take into account the fact that the cluster info provided might be null.- Specified by:
setClusterInfoin interfaceClusterInfoAware- Parameters:
clusterInfo- The cluster information to be injected
-
setServiceExporter
-
execute
Description copied from interface:TaskComputes a result, or throws an exception if unable to do so.- Specified by:
executein interfaceTask<T extends Serializable>- Returns:
- computed result
- Throws:
Exception- if unable to compute a result
-
getServiceExporter
public static SpaceRemotingServiceExporter getServiceExporter(org.springframework.context.ApplicationContext applicationContext) -
reduce
public List<AsyncResult<ExecutorRemotingTask.InternalExecutorResult<T>>> reduce(List<AsyncResult<ExecutorRemotingTask.InternalExecutorResult<T>>> results) throws Exception - Specified by:
reducein interfaceAsyncResultsReducer<ExecutorRemotingTask.InternalExecutorResult<T extends Serializable>,List<AsyncResult<ExecutorRemotingTask.InternalExecutorResult<T extends Serializable>>>> - Throws:
Exception
-
getRouting
Description copied from interface:TaskRoutingProviderReturns the routing of the task.- Specified by:
getRoutingin interfaceSpaceRemotingInvocation- Specified by:
getRoutingin interfaceTaskRoutingProvider
-
getLookupName
Description copied from interface:SpaceRemotingInvocationThe lookup name of the service. Usually the actual interface class name that is proxied on the client side and implemented on the server side.- Specified by:
getLookupNamein interfaceSpaceRemotingInvocation
-
getMethodName
Description copied from interface:SpaceRemotingInvocationThe method name of the service that will be executed.- Specified by:
getMethodNamein interfaceSpaceRemotingInvocation
-
getMethodHash
-
getArguments
Description copied from interface:SpaceRemotingInvocationThe arguments for the service method execution.- Specified by:
getArgumentsin interfaceSpaceRemotingInvocation
-
getMetaArguments
Description copied from interface:SpaceRemotingInvocationMeta arguments that can be passed as part of the invocation. This arguments are not used to invoke the method, but can be used to control ceratin pluggable invocation "aspects".- Specified by:
getMetaArgumentsin interfaceSpaceRemotingInvocation
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-