public class ClassLoaderContextSelector extends java.lang.Object implements ContextSelector, LoggerContextShutdownAware
Modifier and Type | Field and Description |
---|---|
protected static java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.atomic.AtomicReference<java.lang.ref.WeakReference<LoggerContext>>> |
CONTEXT_MAP |
private static java.util.concurrent.atomic.AtomicReference<LoggerContext> |
DEFAULT_CONTEXT |
protected static StatusLogger |
LOGGER |
DEFAULT_STOP_TIMEOUT
Constructor and Description |
---|
ClassLoaderContextSelector() |
Modifier and Type | Method and Description |
---|---|
void |
contextShutdown(LoggerContext loggerContext) |
protected LoggerContext |
createContext(java.lang.String name,
java.net.URI configLocation) |
protected java.lang.String |
defaultContextName() |
private LoggerContext |
findContext(java.lang.ClassLoader loaderOrNull) |
LoggerContext |
getContext(java.lang.String fqcn,
java.lang.ClassLoader loader,
boolean currentContext)
Returns the LoggerContext.
|
LoggerContext |
getContext(java.lang.String fqcn,
java.lang.ClassLoader loader,
boolean currentContext,
java.net.URI configLocation)
Returns the LoggerContext.
|
protected LoggerContext |
getDefault() |
java.util.List<LoggerContext> |
getLoggerContexts()
Returns a List of all the available LoggerContexts.
|
boolean |
hasContext(java.lang.String fqcn,
java.lang.ClassLoader loader,
boolean currentContext)
Checks to see if a LoggerContext is installed.
|
private LoggerContext |
locateContext(java.lang.ClassLoader loaderOrNull,
java.net.URI configLocation) |
void |
removeContext(LoggerContext context)
Remove any references to the LoggerContext.
|
void |
shutdown(java.lang.String fqcn,
java.lang.ClassLoader loader,
boolean currentContext,
boolean allContexts)
Shuts down the LoggerContext.
|
protected java.lang.String |
toContextMapKey(java.lang.ClassLoader loader) |
private static final java.util.concurrent.atomic.AtomicReference<LoggerContext> DEFAULT_CONTEXT
protected static final StatusLogger LOGGER
protected static final java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.atomic.AtomicReference<java.lang.ref.WeakReference<LoggerContext>>> CONTEXT_MAP
public void shutdown(java.lang.String fqcn, java.lang.ClassLoader loader, boolean currentContext, boolean allContexts)
ContextSelector
shutdown
in interface ContextSelector
fqcn
- The fully qualified class name of the caller.loader
- The ClassLoader to use or null.currentContext
- If true returns the current Context, if false returns the Context appropriateallContexts
- if true all LoggerContexts that can be located will be shutdown.public void contextShutdown(LoggerContext loggerContext)
contextShutdown
in interface LoggerContextShutdownAware
public boolean hasContext(java.lang.String fqcn, java.lang.ClassLoader loader, boolean currentContext)
ContextSelector
hasContext
in interface ContextSelector
fqcn
- The fully qualified class name of the caller.loader
- The ClassLoader to use or null.currentContext
- If true returns the current Context, if false returns the Context appropriate
for the caller if a more appropriate Context can be determined.private LoggerContext findContext(java.lang.ClassLoader loaderOrNull)
public LoggerContext getContext(java.lang.String fqcn, java.lang.ClassLoader loader, boolean currentContext)
ContextSelector
getContext
in interface ContextSelector
fqcn
- The fully qualified class name of the caller.loader
- ClassLoader to use or null.currentContext
- If true returns the current Context, if false returns the Context appropriate
for the caller if a more appropriate Context can be determined.public LoggerContext getContext(java.lang.String fqcn, java.lang.ClassLoader loader, boolean currentContext, java.net.URI configLocation)
ContextSelector
getContext
in interface ContextSelector
fqcn
- The fully qualified class name of the caller.loader
- ClassLoader to use or null.currentContext
- If true returns the current Context, if false returns the Context appropriate
for the caller if a more appropriate Context can be determined.configLocation
- The location of the configuration for the LoggerContext.public void removeContext(LoggerContext context)
ContextSelector
removeContext
in interface ContextSelector
context
- The context to remove.public java.util.List<LoggerContext> getLoggerContexts()
ContextSelector
getLoggerContexts
in interface ContextSelector
private LoggerContext locateContext(java.lang.ClassLoader loaderOrNull, java.net.URI configLocation)
protected LoggerContext createContext(java.lang.String name, java.net.URI configLocation)
protected java.lang.String toContextMapKey(java.lang.ClassLoader loader)
protected LoggerContext getDefault()
protected java.lang.String defaultContextName()