Class ContextBase

    • Constructor Detail

      • ContextBase

        public ContextBase()
    • Method Detail

      • 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
      • 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
      • 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
      • reset

        public void reset()
        Clear the internal objectMap and all properties. Removes 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.
      • 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