Class TaskContext


  • public class TaskContext
    extends java.lang.Object
    TaskContext. Defines the execution context of a task by specifying parameters, cache and marshaller
    Since:
    8.1
    Author:
    Tristan Tarrant
    • Constructor Summary

      Constructors 
      Constructor Description
      TaskContext()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TaskContext addParameter​(java.lang.String name, java.lang.Object value)
      Adds a named parameter to the task context
      TaskContext cache​(org.infinispan.Cache<?,​?> cache)
      The cache against which this task will be executed.
      TaskContext cacheManager​(org.infinispan.manager.EmbeddedCacheManager cacheManager)
      The cache manager with which this task should be executed
      java.util.Optional<org.infinispan.Cache<?,​?>> getCache()
      The default cache.
      org.infinispan.manager.EmbeddedCacheManager getCacheManager()
      CacheManager for this task execution
      java.util.Optional<Marshaller> getMarshaller()
      Marshaller for this task execution
      java.util.Optional<java.util.Map<java.lang.String,​?>> getParameters()
      Gets a map of named parameters for the task
      java.util.Optional<javax.security.auth.Subject> getSubject()
      The optional Subject which is executing this task
      boolean isLogEvent()
      Whether executing this task will generate an event in the event log
      TaskContext logEvent​(boolean logEvent)
      Whether execution will generate an event in the event log
      TaskContext marshaller​(Marshaller marshaller)
      The marshaller with which this task should be executed
      TaskContext parameters​(java.util.Map<java.lang.String,​?> parameters)
      A map of named parameters that will be passed to the task.
      TaskContext subject​(javax.security.auth.Subject subject)
      The subject to impersonate when running this task.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TaskContext

        public TaskContext()
    • Method Detail

      • cacheManager

        public TaskContext cacheManager​(org.infinispan.manager.EmbeddedCacheManager cacheManager)
        The cache manager with which this task should be executed
      • marshaller

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

        public TaskContext cache​(org.infinispan.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​(java.util.Map<java.lang.String,​?> parameters)
        A map of named parameters that will be passed to the task. Invoking this method overwrites any previously set parameters
      • subject

        public TaskContext subject​(javax.security.auth.Subject subject)
        The subject to impersonate when running this task. If unspecified, the Subject (if any) will be retrieved via Security.getSubject()
      • addParameter

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

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

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

        public java.util.Optional<Marshaller> getMarshaller()
        Marshaller for this task execution
        Returns:
        optional marshaller
      • getCache

        public java.util.Optional<org.infinispan.Cache<?,​?>> getCache()
        The default cache. Other caches can be obtained from cache manager (Cache.getCacheManager())
        Returns:
        optional cache
      • getParameters

        public java.util.Optional<java.util.Map<java.lang.String,​?>> getParameters()
        Gets a map of named parameters for the task
        Returns:
        optional map of named parameters for the task
      • getSubject

        public java.util.Optional<javax.security.auth.Subject> getSubject()
        The optional Subject which is executing this task
        Returns:
        the Subject
      • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object