Removes all thread attributes.
Removes all thread attributes. This includes all stacked values.
Executes a thunk, during which the specified thread attributes will be in place.
Executes a thunk, during which the specified thread attributes will be in place. After the thunk has completed,
the thread attributes are returned to their original values (before the call to during
). The return value of
the call is the return value of the thunk.
the return type of the thunk
the thread attribute names and values to push during the thunk execution
the thunk to execute
the return value of the executed thunk
Executes a thunk, during which the specified thread attribute will be in place.
Executes a thunk, during which the specified thread attribute will be in place. After the thunk has completed,
the thread attribute is returned to its original value (before the call to during
). The return value of
the call is the return value of the thunk.
the return type of the thunk
the name of the thread attribute to set
the value of the named thread attribute
the thunk to execute
the return value of the executed thunk
Retrieves the current thread attributes.
Retrieves the current thread attributes.
the stack of values for each attribute on this thread as a map of lists
Retrieves the current thread attributes.
Retrieves the current thread attributes.
the topmost value on the stack for each attribute on this thread as a map
Pops a collection of old values from the stacks for the named thread attributes.
Pops a collection of old values from the stacks for the named thread attributes. The expected values must
match the values on tops of the stacks, or else an exception will be thrown. This is to protect against
programming errors where the push
and pop
calls don't match up.
a map of the thread attribute names to pop and the expected value for each
Pops an old value from the stack for the named thread attribute.
Pops an old value from the stack for the named thread attribute. The expected value must be specified and, if
it does not match the value on top of the stack, will throw an exception. This is to protect against
programming errors where the push
and pop
calls don't match up.
the name of the attribute for which to pop a value
the expected value to pop for the named attribute
Pushes a collection of values onto the stacks of several thread attributes.
Pushes a collection of values onto the stacks of several thread attributes.
the thread attribute names and values to push
Pushes a new value onto the stack for the named thread attribute.
Pushes a new value onto the stack for the named thread attribute.
the name of the attribute for which to push a value
the value to push for the named attribute
Provides a convenient mechanism for associating thread-specific attributes with your log entries. Loggers will copy the thread-specific attributes available through this object (ThreadAttributes.get()) into the
threadAttributes
field of every entry they create.Thread attribute values are stacked, making it possible to push an attribute value for a specific code block and then pop the value from the attribute stack, leaving the thread attributes in the state that was present before the block was executed. This is directly implemented in the
during()
method calls. It can also be managed explicitly by the calling code (e.g., when the push and pop operations need to span method bodies) using thepush
andpop
methods.