public class AuthTokenThreadContextListener extends Object implements ThreadContextListener
ThreadContextListener
that ensures the correct initialization of AuthToken
s when
working with non-container managed threads on all supported Cloud platforms.ThreadContextListener.DefaultPriorities
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_AUTH_TOKEN
The ThreadContext key.
|
Constructor and Description |
---|
AuthTokenThreadContextListener()
Default constructor.
|
AuthTokenThreadContextListener(AuthToken authToken)
Constructor for providing a
AuthToken to be returned by this listener. |
Modifier and Type | Method and Description |
---|---|
void |
afterInitialize(ThreadContext threadContext,
ThreadContext parentThreadContext)
Invoked after the current
ThreadContext is initialized and set. |
void |
beforeDestroy(ThreadContext threadContext,
ThreadContext parentThreadContext)
Invoked before the current
ThreadContext is destroyed and reset. |
int |
getPriority()
Returns the priority that defines the order in which listeners are invoked.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterDestroy, beforeInitialize, compareTo
public static final String PROPERTY_AUTH_TOKEN
public AuthTokenThreadContextListener()
public int getPriority()
getPriority
in interface ThreadContextListener
public void afterInitialize(@Nonnull ThreadContext threadContext, @Nullable ThreadContext parentThreadContext)
ThreadContext
is initialized and set.afterInitialize
in interface ThreadContextListener
threadContext
- The ThreadContext
that was initialized is now set.parentThreadContext
- The parent ThreadContext
, or null
if there is no parent ThreadContext
.public void beforeDestroy(@Nonnull ThreadContext threadContext, @Nullable ThreadContext parentThreadContext)
ThreadContext
is destroyed and reset.beforeDestroy
in interface ThreadContextListener
threadContext
- The ThreadContext
that is destroyed and will be removed.parentThreadContext
- The parent ThreadContext
, or null
if there is no parent ThreadContext
.Copyright © 2020 SAP SE. All rights reserved.