Class ContextBase

java.lang.Object
ch.qos.logback.core.ContextBase
All Implemented Interfaces:
Context, LifeCycle, PropertyContainer

public class ContextBase extends Object implements Context, LifeCycle
  • Field Details

  • Constructor Details

    • ContextBase

      public ContextBase()
  • Method Details

    • getStatusManager

      public StatusManager getStatusManager()
      Description copied from interface: Context
      Return the StatusManager instance in use.
      Specified by:
      getStatusManager in interface Context
      Returns:
      the StatusManager instance in use.
    • setStatusManager

      public void setStatusManager(StatusManager statusManager)
      Set the StatusManager for this context. Note that by default this context is initialized with a BasicStatusManager. A null value for the 'statusManager' argument is not allowed.

      A malicious attacker can set the status manager to a dummy instance, disabling internal error reporting.

      Parameters:
      statusManager - the new status manager
    • getCopyOfPropertyMap

      public Map<String,String> getCopyOfPropertyMap()
      Description copied from interface: Context
      Get a copy of the property map
      Specified by:
      getCopyOfPropertyMap in interface Context
      Specified by:
      getCopyOfPropertyMap in interface PropertyContainer
    • putProperty

      public void putProperty(String key, String val)
      Description copied from interface: Context
      Set a property of this context.
      Specified by:
      putProperty in interface Context
    • initCollisionMaps

      protected void initCollisionMaps()
    • getProperty

      public String getProperty(String key)
      Given a key, return the corresponding property value. If invoked with the special key "CONTEXT_NAME", the name of the context is returned.
      Specified by:
      getProperty in interface Context
      Specified by:
      getProperty in interface PropertyContainer
      Parameters:
      key -
      Returns:
    • getObject

      public Object getObject(String key)
      Description copied from interface: Context
      A Context can act as a store for various objects used by LOGBack components.
      Specified by:
      getObject in interface Context
      Returns:
      The object stored under 'key'.
    • putObject

      public void putObject(String key, Object value)
      Description copied from interface: Context
      Store an object under 'key'. If no object can be found, null is returned.
      Specified by:
      putObject in interface Context
    • removeObject

      public void removeObject(String key)
    • getName

      public String getName()
      Description copied from interface: Context
      Contexts are named objects.
      Specified by:
      getName in interface Context
      Returns:
      the name for this context
    • start

      public void start()
      Specified by:
      start in interface LifeCycle
    • stop

      public void stop()
      Specified by:
      stop in interface LifeCycle
    • isStarted

      public boolean isStarted()
      Specified by:
      isStarted in interface LifeCycle
    • reset

      public void reset()
      Clear the internal objectMap and all properties. Removes any registered shutdown hook.
    • setName

      public void setName(String name) throws IllegalStateException
      The context name can be set only if it is not already set, or if the current name is the default context name, namely "default", or if the current name and the old name are the same.
      Specified by:
      setName in interface Context
      Throws:
      IllegalStateException - if the context already has a name, other than "default".
    • getBirthTime

      public long getBirthTime()
      Description copied from interface: Context
      The time at which this context was created, expressed in millisecond elapsed since the epoch (1.1.1970).
      Specified by:
      getBirthTime in interface Context
      Returns:
      The time as measured when this class was created.
    • getConfigurationLock

      public Object getConfigurationLock()
      Description copied from interface: Context
      Object used for synchronization purposes. INTENDED FOR INTERNAL USAGE.
      Specified by:
      getConfigurationLock in interface Context
    • getExecutorService

      public ExecutorService getExecutorService()
      Description copied from interface: Context
      Every context has an ExecutorService which be invoked to execute certain tasks in a separate thread.
      Specified by:
      getExecutorService in interface Context
      Returns:
      the executor for this context.
    • getScheduledExecutorService

      public ScheduledExecutorService getScheduledExecutorService()
      Description copied from interface: Context
      Returns the ScheduledExecutorService for this context.
      Specified by:
      getScheduledExecutorService in interface Context
      Returns:
    • register

      public void register(LifeCycle component)
      Description copied from interface: Context
      Register a component that participates in the context's life cycle.

      All components registered via this method will be stopped and removed from the context when the context is reset.

      Specified by:
      register in interface Context
      Parameters:
      component - the subject component
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addScheduledFuture

      public void addScheduledFuture(ScheduledFuture<?> scheduledFuture)
      Description copied from interface: Context
      Add scheduledFuture parameter to the list of known futures.
      Specified by:
      addScheduledFuture in interface Context
    • getScheduledFutures

      @Deprecated public List<ScheduledFuture<?>> getScheduledFutures()
      Deprecated.
      replaced by getCopyOfScheduledFutures
    • getCopyOfScheduledFutures

      public List<ScheduledFuture<?>> getCopyOfScheduledFutures()
    • getSequenceNumberGenerator

      public SequenceNumberGenerator getSequenceNumberGenerator()
      Specified by:
      getSequenceNumberGenerator in interface Context
    • setSequenceNumberGenerator

      public void setSequenceNumberGenerator(SequenceNumberGenerator sequenceNumberGenerator)
      Specified by:
      setSequenceNumberGenerator in interface Context