Class AiSpectContextHolder

java.lang.Object
com.aispect.common.context.AiSpectContextHolder

public class AiSpectContextHolder extends Object
based on ThreadLocal A context holder for passing implicit parameters throughout the framework chain.
  • Method Details

    • set

      public static void set(String key, Object value)
      Sets a key-value pair in the current context.
      Parameters:
      key - key
      value - value
    • get

      public static Object get(String key)
      Gets the value from the current context.
      Parameters:
      key - key
      Returns:
      The corresponding value, returned if not found null
    • getContext

      public static Map<String,Object> getContext()
      Get the entire context mapping dictionary.
      Returns:
      context mapping
    • setContext

      public static void setContext(Map<String,Object> map)
      Override the entire context mapping dictionary.
      Parameters:
      map - new context mapping
    • clear

      public static void clear()
      Clean up the context of the current thread. must be in finally block to prevent memory leaks when using the thread pool.