Top Description Fields Constructors Methods
org.jboss.logmanager

public final Class ThreadLocalLogContextSelector

extends Object
implements LogContextSelector
Class Inheritance
All Implemented Interfaces
org.jboss.logmanager.LogContextSelector

A log context selector which stores the chosen log context in a thread-local.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final ThreadLocal<LogContext>
private final LogContextSelector
private final Object

Constructor Summary

AccessConstructor and Description
public
ThreadLocalLogContextSelector(final LogContextSelector
the selector to delegate to if no context is chosen
delegate
)

Construct a new instance.

public
ThreadLocalLogContextSelector(final Object
the security key required to push or pop a log context.
securityKey
,
final LogContextSelector
the selector to delegate to if no context is chosen
delegate
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public LogContext

Returns:

the previous log context value, or null if none was set
getAndSet
(Object
the security key to check (ignored if none was set on construction)
securityKey
,
LogContext
the new log context value, or null to clear
newValue
)

Get and set the log context.

public LogContext
getLogContext()

Implements org.jboss.logmanager.LogContextSelector.getLogContext.

Get the current log context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final ThreadLocal<LogContext> context
delegateback to summary
private final LogContextSelector delegate
securityKeyback to summary
private final Object securityKey

Constructor Detail

ThreadLocalLogContextSelectorback to summary
public ThreadLocalLogContextSelector(final LogContextSelector delegate)

Construct a new instance.

Parameters
delegate:LogContextSelector

the selector to delegate to if no context is chosen

ThreadLocalLogContextSelectorback to summary
public ThreadLocalLogContextSelector(final Object securityKey, final LogContextSelector delegate)

Construct a new instance.

Parameters
securityKey:Object

the security key required to push or pop a log context.

delegate:LogContextSelector

the selector to delegate to if no context is chosen

Method Detail

getAndSetback to summary
public LogContext getAndSet(Object securityKey, LogContext newValue)

Get and set the log context.

Parameters
securityKey:Object

the security key to check (ignored if none was set on construction)

newValue:LogContext

the new log context value, or null to clear

Returns:LogContext

the previous log context value, or null if none was set

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