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 theRequestHeaderThreadContextListenerclass without aRequestHeaderContainer.RequestHeaderThreadContextListener(RequestHeaderContainer requestHeaders) Initializes a new instance of theRequestHeaderThreadContextListenerclass with the givenrequestHeaders. -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeInitialize(ThreadContext threadContext) Invoked before the currentThreadContextis initialized and set.intReturns 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, waitMethods 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 theRequestHeaderThreadContextListenerclass without aRequestHeaderContainer. -
RequestHeaderThreadContextListener
Initializes a new instance of theRequestHeaderThreadContextListenerclass with the givenrequestHeaders.- Parameters:
requestHeaders- TheRequestHeaderContainerto use.
-
-
Method Details
-
getPriority
public int getPriority()Description copied from interface:ThreadContextListenerReturns 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:
getPriorityin interfaceThreadContextListener- Returns:
- The priority of this listener implementation.
-
beforeInitialize
Description copied from interface:ThreadContextListenerInvoked before the currentThreadContextis initialized and set. This method can be used, for example, to inherit properties from the parent context.ThreadContextAccessor.getCurrentContext()returns the oldThreadContextreference.- Specified by:
beforeInitializein interfaceThreadContextListener- Parameters:
threadContext- TheThreadContextthat is initialized and will be set.
-