Class TaskContext


  • @ProtoTypeId(4804)
    public class TaskContext
    extends Object
    TaskContext. Defines the execution context of a task by specifying parameters, cache and marshaller
    Since:
    8.1
    Author:
    Tristan Tarrant
    • Constructor Detail

      • TaskContext

        public TaskContext()
      • TaskContext

        public TaskContext​(TaskContext other)
    • Method Detail

      • marshaller

        public TaskContext marshaller​(Marshaller marshaller)
        The marshaller with which this task should be executed
      • cache

        public TaskContext cache​(Cache<?,​?> cache)
        The cache against which this task will be executed. This will be the task's default cache, but other caches can be obtained from the cache manager
      • parameters

        public TaskContext parameters​(Map<String,​?> parameters)
        A map of named parameters that will be passed to the task. Invoking this method overwrites any previously set parameters
      • addParameter

        public TaskContext addParameter​(String name,
                                        Object value)
        Adds a named parameter to the task context
      • addOptionalParameter

        public TaskContext addOptionalParameter​(String name,
                                                Object value)
        Adds a named parameter to the task context only if it is non-null
      • logEvent

        public TaskContext logEvent​(boolean logEvent)
        Whether execution will generate an event in the event log
      • getCacheManager

        public EmbeddedCacheManager getCacheManager()
        CacheManager for this task execution
        Returns:
        the cache manager
      • getMarshaller

        public Optional<Marshaller> getMarshaller()
        Marshaller for this task execution
        Returns:
        optional marshaller
      • getParameters

        public Optional<Map<String,​Object>> getParameters()
        Gets a map of named parameters for the task
        Returns:
        optional map of named parameters for the task
      • isLogEvent

        public boolean isLogEvent()
        Whether executing this task will generate an event in the event log
        Returns:
        true if an event will be logged, false otherwise
      • subject

        @ProtoField(2)
        public Subject subject()