Top Inners Fields Constructors Methods
org.jboss.logmanager

pack-priv final Class ThreadLocalNDC

extends Object
implements NDCProvider
Class Inheritance
All Implemented Interfaces
org.jboss.logmanager.NDCProvider
Imports
java.util.Arrays

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final ThreadLocalNDC.Holder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.jboss.logmanager.NDCProvider.clear.

Clear the thread's NDC stack.

public String
get()

Implements org.jboss.logmanager.NDCProvider.get.

Get the current NDC value.

public String
get(int
the index
n
)

Implements org.jboss.logmanager.NDCProvider.get.

Provided for compatibility with log4j.

public int
getDepth()

Implements org.jboss.logmanager.NDCProvider.getDepth.

Get the current NDC stack depth.

public String
pop()

Implements org.jboss.logmanager.NDCProvider.pop.

Pop the topmost value from the NDC stack and return it.

public int
push(String
the new value
context
)

Implements org.jboss.logmanager.NDCProvider.push.

Push a value on to the NDC stack, returning the new stack depth which should later be used to restore the stack.

public void
trimTo(int
the new size
size
)

Implements org.jboss.logmanager.NDCProvider.trimTo.

Trim the thread NDC stack down to no larger than the given size.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ndcback to summary
private static final ThreadLocalNDC.Holder ndc

Constructor Detail

ThreadLocalNDCback to summary
pack-priv ThreadLocalNDC()

Method Detail

clearback to summary
public void clear()

Implements org.jboss.logmanager.NDCProvider.clear.

Doc from org.jboss.logmanager.NDCProvider.clear.

Clear the thread's NDC stack.

Annotations
@Override
getback to summary
public String get()

Implements org.jboss.logmanager.NDCProvider.get.

Doc from org.jboss.logmanager.NDCProvider.get.

Get the current NDC value.

Returns:String

the current NDC value, or "" if there is none

Annotations
@Override
getback to summary
public String get(int n)

Implements org.jboss.logmanager.NDCProvider.get.

Doc from org.jboss.logmanager.NDCProvider.get.

Provided for compatibility with log4j. Get the NDC value that is n entries from the bottom.

Parameters
n:int

the index

Returns:String

the value or null if there is none

Annotations
@Override
getDepthback to summary
public int getDepth()

Implements org.jboss.logmanager.NDCProvider.getDepth.

Doc from org.jboss.logmanager.NDCProvider.getDepth.

Get the current NDC stack depth.

Returns:int

the stack depth

Annotations
@Override
popback to summary
public String pop()

Implements org.jboss.logmanager.NDCProvider.pop.

Doc from org.jboss.logmanager.NDCProvider.pop.

Pop the topmost value from the NDC stack and return it.

Returns:String

the old topmost value

Annotations
@Override
pushback to summary
public int push(String context)

Implements org.jboss.logmanager.NDCProvider.push.

Doc from org.jboss.logmanager.NDCProvider.push.

Push a value on to the NDC stack, returning the new stack depth which should later be used to restore the stack.

Parameters
context:String

the new value

Returns:int

the new stack depth

Annotations
@Override
trimToback to summary
public void trimTo(int size)

Implements org.jboss.logmanager.NDCProvider.trimTo.

Doc from org.jboss.logmanager.NDCProvider.trimTo.

Trim the thread NDC stack down to no larger than the given size. Used to restore the stack to the depth returned by a push().

Parameters
size:int

the new size

Annotations
@Override
org.jboss.logmanager back to summary

private final Class ThreadLocalNDC.Holder

extends ThreadLocal<ThreadLocalNDC.Stack<String>>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected ThreadLocalNDC.Stack<String>
initialValue()

Overrides java.lang.ThreadLocal.initialValue.

Returns the current thread's "initial value" for this thread-local variable.

Inherited from java.lang.ThreadLocal:
getremovesetwithInitial

Constructor Detail

Holderback to summary
private Holder()

Method Detail

initialValueback to summary
protected ThreadLocalNDC.Stack<String> initialValue()

Overrides java.lang.ThreadLocal.initialValue.

Doc from java.lang.ThreadLocal.initialValue.

Returns the current thread's "initial value" for this thread-local variable. This method will be invoked the first time a thread accesses the variable with the get method, unless the thread previously invoked the set method, in which case the initialValue method will not be invoked for the thread. Normally, this method is invoked at most once per thread, but it may be invoked again in case of subsequent invocations of remove followed by get.

Returns:ThreadLocalNDC.Stack<String>

the initial value for this thread-local

org.jboss.logmanager back to summary

private final Class ThreadLocalNDC.Stack<T>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Object[]
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
public T
get(int n)

public boolean
public T
pop()

public void
push(T value)

public T
top()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
trimTo(int max)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

databack to summary
private Object[] data
spback to summary
private int sp

Constructor Detail

Stackback to summary
private Stack()

Method Detail

depthback to summary
public int depth()
getback to summary
public T get(int n)
Annotations
@SuppressWarnings:unchecked
isEmptyback to summary
public boolean isEmpty()
popback to summary
public T pop()
Annotations
@SuppressWarnings:unchecked
pushback to summary
public void push(T value)
topback to summary
public T top()
Annotations
@SuppressWarnings:unchecked
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

trimToback to summary
public void trimTo(int max)