JBoss Log Manager 1.4.1.Final

org.jboss.logmanager
Class ThreadLocalLogContextSelector

java.lang.Object
  extended by org.jboss.logmanager.ThreadLocalLogContextSelector
All Implemented Interfaces:
LogContextSelector

public final class ThreadLocalLogContextSelector
extends Object
implements LogContextSelector

A log context selector which stores the chosen log context in a thread-local.

Author:
David M. Lloyd

Constructor Summary
ThreadLocalLogContextSelector(LogContextSelector delegate)
          Construct a new instance.
ThreadLocalLogContextSelector(Object securityKey, LogContextSelector delegate)
          Construct a new instance.
 
Method Summary
 LogContext getAndSet(Object securityKey, LogContext newValue)
          Get and set the log context.
 LogContext getLogContext()
          Get the current log context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalLogContextSelector

public ThreadLocalLogContextSelector(LogContextSelector delegate)
Construct a new instance.

Parameters:
delegate - the selector to delegate to if no context is chosen

ThreadLocalLogContextSelector

public ThreadLocalLogContextSelector(Object securityKey,
                                     LogContextSelector delegate)
Construct a new instance.

Parameters:
securityKey - the security key required to push or pop a log context.
delegate - the selector to delegate to if no context is chosen
Method Detail

getLogContext

public LogContext getLogContext()
Description copied from interface: LogContextSelector
Get the current log context.

Specified by:
getLogContext in interface LogContextSelector
Returns:
the current log context

getAndSet

public LogContext getAndSet(Object securityKey,
                            LogContext newValue)
Get and set the log context.

Parameters:
securityKey - the security key to check (ignored if none was set on construction)
newValue - the new log context value, or null to clear
Returns:
the previous log context value, or null if none was set

JBoss Log Manager 1.4.1.Final

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.