Package org.infinispan.tasks
Interface ServerTask<V>
-
public interface ServerTask<V> extends Callable<V>, Task
An interface representing a deployed server task. The task will be accessible by the name returned byTask.getName()Before the execution,TaskContextis injected into the task to provideEmbeddedCacheManager,Cache,Marshallerand parameters.- Author:
- Michal Szynkiewicz <michal.l.szynkiewicz@gmail.com>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default StringgetType()Returns the type of task.voidsetTaskContext(TaskContext taskContext)Sets the task context Store the value in your task implementation to be able to access caches and other resources in the task Note that there will be a single instance of each ServerTask on each server so, if you expect concurrent invocations of a task, theTaskContextshould be stored in aThreadLocalstatic field in your task.-
Methods inherited from interface org.infinispan.tasks.Task
getAllowedRole, getExecutionMode, getName, getParameters
-
-
-
-
Method Detail
-
setTaskContext
void setTaskContext(TaskContext taskContext)
Sets the task context Store the value in your task implementation to be able to access caches and other resources in the task Note that there will be a single instance of each ServerTask on each server so, if you expect concurrent invocations of a task, theTaskContextshould be stored in aThreadLocalstatic field in your task. The TaskContext should then be obtained during the task'sCallable.call()method and removed from the ThreadLocal.- Parameters:
taskContext- task execution context
-
-