java.lang.Object
ch.qos.logback.core.ContextBase
- All Implemented Interfaces:
Context
,LifeCycle
,PropertyContainer
- Direct Known Subclasses:
LoggerContext
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add aConfigurationEventListener
to this context.void
addScheduledFuture
(ScheduledFuture<?> scheduledFuture) Add scheduledFuture parameter to the list of known futures.void
addSubstitutionProperty
(String key, String value) void
fireConfigurationEvent
(ConfigurationEvent configurationEvent) FireConfigurationEvent
by invokingregistered listeners
.Return an alternateExecutorService
used for one task per thread execution.long
The time at which this context was created, expressed in millisecond elapsed since the epoch (1.1.1970).Object used for synchronization purposes.Get a copy of the property mapList
<ScheduledFuture<?>> Every context has an ExecutorService which be invoked to execute certain tasks in a separate thread.getName()
Contexts are named objects.A Context can act as a store for various objects used by LOGBack components.getProperty
(String key) Given a key, return the corresponding property value.Returns the ScheduledExecutorService for this context.List
<ScheduledFuture<?>> Deprecated.replaced by getCopyOfScheduledFuturesReturn the StatusManager instance in use.protected void
boolean
void
Store an object under 'key'.void
putProperty
(String key, String val) Set a property of this context.void
Register a component that participates in the context's life cycle.void
removeObject
(String key) void
reset()
Clear the internal objectMap and all properties.void
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.void
setSequenceNumberGenerator
(SequenceNumberGenerator sequenceNumberGenerator) void
setStatusManager
(StatusManager statusManager) Set theStatusManager
for this context.void
start()
void
stop()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.PropertyContainer
addSubstitutionProperties
-
Field Details
-
scheduledFutures
-
-
Constructor Details
-
ContextBase
public ContextBase()
-
-
Method Details
-
getStatusManager
Description copied from interface:Context
Return the StatusManager instance in use.- Specified by:
getStatusManager
in interfaceContext
- Returns:
- the
StatusManager
instance in use.
-
setStatusManager
Set theStatusManager
for this context. Note that by default this context is initialized with aBasicStatusManager
. 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
Description copied from interface:Context
Get a copy of the property map- Specified by:
getCopyOfPropertyMap
in interfaceContext
- Specified by:
getCopyOfPropertyMap
in interfacePropertyContainer
- Returns:
-
putProperty
Description copied from interface:Context
Set a property of this context.- Specified by:
putProperty
in interfaceContext
-
initCollisionMaps
-
addSubstitutionProperty
- Specified by:
addSubstitutionProperty
in interfacePropertyContainer
-
getProperty
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 interfaceContext
- Specified by:
getProperty
in interfacePropertyContainer
- Parameters:
key
-- Returns:
-
getObject
Description copied from interface:Context
A Context can act as a store for various objects used by LOGBack components. -
putObject
Description copied from interface:Context
Store an object under 'key'. If no object can be found, null is returned. -
removeObject
-
getName
Description copied from interface:Context
Contexts are named objects. -
start
-
stop
-
isStarted
-
reset
Clear the internal objectMap and all properties. Removes any registered shutdown hook. -
setName
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 interfaceContext
- Parameters:
name
-- Throws:
IllegalStateException
- if the context already has a name, other than "default".
-
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 interfaceContext
- Returns:
- The time as measured when this class was created.
-
getConfigurationLock
Description copied from interface:Context
Object used for synchronization purposes. INTENDED FOR INTERNAL USAGE.- Specified by:
getConfigurationLock
in interfaceContext
-
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 interfaceContext
- Returns:
- the executor for this context.
-
getAlternateExecutorService
Description copied from interface:Context
Return an alternateExecutorService
used for one task per thread execution.- Specified by:
getAlternateExecutorService
in interfaceContext
- Returns:
- ExecutorService
-
getScheduledExecutorService
Description copied from interface:Context
Returns the ScheduledExecutorService for this context.- Specified by:
getScheduledExecutorService
in interfaceContext
- Returns:
- ScheduledExecutorService
-
register
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.
-
toString
-
addScheduledFuture
Description copied from interface:Context
Add scheduledFuture parameter to the list of known futures.- Specified by:
addScheduledFuture
in interfaceContext
- Parameters:
scheduledFuture
-
-
getScheduledFutures
Deprecated.replaced by getCopyOfScheduledFutures -
getCopyOfScheduledFutures
-
getSequenceNumberGenerator
- Specified by:
getSequenceNumberGenerator
in interfaceContext
-
setSequenceNumberGenerator
- Specified by:
setSequenceNumberGenerator
in interfaceContext
-
addConfigurationEventListener
Description copied from interface:Context
Add aConfigurationEventListener
to this context.Configuration events are supposed to be rare and listeners to such events rarer still.
The propagation of
configuration events
is intended for internal testing as well as some coordination between configurators.- Specified by:
addConfigurationEventListener
in interfaceContext
- Parameters:
listener
-
-
fireConfigurationEvent
Description copied from interface:Context
FireConfigurationEvent
by invokingregistered listeners
.Note that it is the role of configurators to invoke this method as a context does not necessarily know when it is being configured.
- Specified by:
fireConfigurationEvent
in interfaceContext
- Parameters:
configurationEvent
-
-