Top Description Fields Constructors Methods
org.jboss.logmanager

public final Class ContextClassLoaderLogContextSelector

extends Object
implements LogContextSelector
Class Inheritance
All Implemented Interfaces
org.jboss.logmanager.LogContextSelector
Static Imports
java.lang.System.getSecurityManager, .Thread.currentThread, java.security.AccessController.doPrivileged

A log context selector which chooses a log context based on the thread context classloader.

Field Summary

Modifier and TypeField and Description
private final ConcurrentMap<ClassLoader, LogContext>
private final LogContextSelector
private final PrivilegedAction<LogContext>
private static final Permission
private static final Permission

Constructor Summary

AccessConstructor and Description
public
ContextClassLoaderLogContextSelector(final LogContextSelector
the selector to consult if no matching log context is found
defaultSelector
)

Construct a new instance.

public
ContextClassLoaderLogContextSelector()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public LogContext
getLogContext()

Implements org.jboss.logmanager.LogContextSelector.getLogContext.

Get the current log context.

public void
registerLogContext(ClassLoader
the classloader
classLoader
,
LogContext
the log context
logContext
)

Register a class loader with a log context.

public boolean

Returns:

true if the association exists and was removed, false otherwise
unregisterLogContext
(ClassLoader
the classloader
classLoader
,
LogContext
the log context
logContext
)

Unregister a class loader/log context association.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextMapback to summary
private final ConcurrentMap<ClassLoader, LogContext> contextMap
defaultSelectorback to summary
private final LogContextSelector defaultSelector
logContextActionback to summary
private final PrivilegedAction<LogContext> logContextAction
REGISTER_LOG_CONTEXT_PERMISSIONback to summary
private static final Permission REGISTER_LOG_CONTEXT_PERMISSION
UNREGISTER_LOG_CONTEXT_PERMISSIONback to summary
private static final Permission UNREGISTER_LOG_CONTEXT_PERMISSION

Constructor Detail

ContextClassLoaderLogContextSelectorback to summary
public ContextClassLoaderLogContextSelector(final LogContextSelector defaultSelector)

Construct a new instance. If no matching log context is found, the provided default selector is consulted.

Parameters
defaultSelector:LogContextSelector

the selector to consult if no matching log context is found

ContextClassLoaderLogContextSelectorback to summary
public ContextClassLoaderLogContextSelector()

Construct a new instance. If no matching log context is found, the system context is used.

Method Detail

getLogContextback to summary
public LogContext getLogContext()

Implements org.jboss.logmanager.LogContextSelector.getLogContext.

Doc from org.jboss.logmanager.LogContextSelector.getLogContext.

Get the current log context.

Returns:LogContext

the current log context

registerLogContextback to summary
public void registerLogContext(ClassLoader classLoader, LogContext logContext) throws IllegalArgumentException

Register a class loader with a log context. This method requires the registerLogContext RuntimePermission.

Parameters
classLoader:ClassLoader

the classloader

logContext:LogContext

the log context

Exceptions
IllegalArgumentException:
if the classloader is already associated with a log context
unregisterLogContextback to summary
public boolean unregisterLogContext(ClassLoader classLoader, LogContext logContext)

Unregister a class loader/log context association. This method requires the unregisterLogContext RuntimePermission.

Parameters
classLoader:ClassLoader

the classloader

logContext:LogContext

the log context

Returns:boolean

true if the association exists and was removed, false otherwise