public final class ContextClassLoaderLogContextSelector extends java.lang.Object implements LogContextSelector
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ConcurrentMap<java.lang.ClassLoader,LogContext> |
contextMap |
private LogContextSelector |
defaultSelector |
private java.security.PrivilegedAction<LogContext> |
logContextAction |
private static java.security.Permission |
REGISTER_LOG_CONTEXT_PERMISSION |
private static java.security.Permission |
UNREGISTER_LOG_CONTEXT_PERMISSION |
| Constructor and Description |
|---|
ContextClassLoaderLogContextSelector()
Construct a new instance.
|
ContextClassLoaderLogContextSelector(LogContextSelector defaultSelector)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
LogContext |
getLogContext()
Get the current log context.
|
void |
registerLogContext(java.lang.ClassLoader classLoader,
LogContext logContext)
Register a class loader with a log context.
|
boolean |
unregisterLogContext(java.lang.ClassLoader classLoader,
LogContext logContext)
Unregister a class loader/log context association.
|
private static final java.security.Permission REGISTER_LOG_CONTEXT_PERMISSION
private static final java.security.Permission UNREGISTER_LOG_CONTEXT_PERMISSION
private final LogContextSelector defaultSelector
private final java.util.concurrent.ConcurrentMap<java.lang.ClassLoader,LogContext> contextMap
private final java.security.PrivilegedAction<LogContext> logContextAction
public ContextClassLoaderLogContextSelector(LogContextSelector defaultSelector)
defaultSelector - the selector to consult if no matching log context is foundpublic ContextClassLoaderLogContextSelector()
public LogContext getLogContext()
LogContextSelectorgetLogContext in interface LogContextSelectorpublic void registerLogContext(java.lang.ClassLoader classLoader,
LogContext logContext)
throws java.lang.IllegalArgumentException
registerLogContext RuntimePermission.classLoader - the classloaderlogContext - the log contextjava.lang.IllegalArgumentException - if the classloader is already associated with a log contextpublic boolean unregisterLogContext(java.lang.ClassLoader classLoader,
LogContext logContext)
unregisterLogContext RuntimePermission.classLoader - the classloaderlogContext - the log contexttrue if the association exists and was removed, false otherwise