Interface ThreadContextListener
- All Superinterfaces:
Comparable<ThreadContextListener>
- All Known Implementing Classes:
AuthTokenThreadContextListener
,BasicAuthenticationThreadContextListener
,PrincipalThreadContextListener
,RequestHeaderThreadContextListener
,TenantThreadContextListener
Enables listening to lifecycle events of a
ThreadContext
. ThreadContextListener
s are invoked by a
ThreadContextExecutor
.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
The priorities used to order the default listeners provided by the SDK. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
afterInitialize
(ThreadContext threadContext) Invoked after the currentThreadContext
is initialized and set.default void
beforeInitialize
(ThreadContext threadContext) Invoked before the currentThreadContext
is initialized and set.default int
compareTo
(ThreadContextListener other) int
Returns the priority that defines the order in which listeners are invoked.
-
Method Details
-
getPriority
int getPriority()Returns the priority that defines the order in which listeners are invoked. Smaller priorities are invoked earlier during context initialization and invoked later (reversed initialization order) during context destruction. Negative number must not be used as they are reserved for internal use.- Returns:
- The priority of this listener implementation.
-
beforeInitialize
Invoked before the currentThreadContext
is initialized and set. This method can be used, for example, to inherit properties from the parent context.ThreadContextAccessor.getCurrentContext()
returns the oldThreadContext
reference.- Parameters:
threadContext
- TheThreadContext
that is initialized and will be set.
-
afterInitialize
Invoked after the currentThreadContext
is initialized and set.- Parameters:
threadContext
- TheThreadContext
that was initialized is now set.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ThreadContextListener>
-