Class RequestHeaderThreadContextListener
java.lang.Object
com.sap.cloud.sdk.cloudplatform.requestheader.RequestHeaderThreadContextListener
- All Implemented Interfaces:
ThreadContextListener
,Comparable<ThreadContextListener>
Implementation of
ThreadContextListener
that ensures the correct initialization of the
RequestHeaderContainer
when working with non-container managed threads on all supported Cloud platforms.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sap.cloud.sdk.cloudplatform.thread.ThreadContextListener
ThreadContextListener.DefaultPriorities
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of theRequestHeaderThreadContextListener
class without aRequestHeaderContainer
.RequestHeaderThreadContextListener
(RequestHeaderContainer requestHeaders) Initializes a new instance of theRequestHeaderThreadContextListener
class with the givenrequestHeaders
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeInitialize
(ThreadContext threadContext) Invoked before the currentThreadContext
is initialized and set.int
Returns the priority that defines the order in which listeners are invoked.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sap.cloud.sdk.cloudplatform.thread.ThreadContextListener
afterInitialize, compareTo
-
Field Details
-
PROPERTY_REQUEST_HEADERS
The ThreadContext key.
-
-
Constructor Details
-
RequestHeaderThreadContextListener
public RequestHeaderThreadContextListener()Initializes a new instance of theRequestHeaderThreadContextListener
class without aRequestHeaderContainer
. -
RequestHeaderThreadContextListener
Initializes a new instance of theRequestHeaderThreadContextListener
class with the givenrequestHeaders
.- Parameters:
requestHeaders
- TheRequestHeaderContainer
to use.
-
-
Method Details
-
getPriority
public int getPriority()Description copied from interface:ThreadContextListener
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.- Specified by:
getPriority
in interfaceThreadContextListener
- Returns:
- The priority of this listener implementation.
-
beforeInitialize
Description copied from interface:ThreadContextListener
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.- Specified by:
beforeInitialize
in interfaceThreadContextListener
- Parameters:
threadContext
- TheThreadContext
that is initialized and will be set.
-