public class ClassLoaderContextSelector extends java.lang.Object implements ContextSelector
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 |
Constructor and Description |
---|
ClassLoaderContextSelector() |
Modifier and Type | Method and Description |
---|---|
protected LoggerContext |
createContext(java.lang.String name,
java.net.URI configLocation) |
protected java.lang.String |
defaultContextName() |
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.
|
private LoggerContext |
locateContext(java.lang.ClassLoader loaderOrNull,
java.net.URI configLocation) |
void |
removeContext(LoggerContext context)
Remove any references to 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 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()