public class HttpClientsThreadContextListener extends Object implements ThreadContextListener
ThreadContextListener
that enables the correct use of Destination
s when working
with non-container managed threads on all supported Cloud platforms. In particular, it initializes a
HttpClient
cache that is maintained per destination.ThreadContextListener.DefaultPriorities
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_HTTP_CLIENTS
The ThreadContext key.
|
Constructor and Description |
---|
HttpClientsThreadContextListener() |
Modifier and Type | Method and Description |
---|---|
void |
beforeDestroy(ThreadContext threadContext,
ThreadContext parentThreadContext)
Invoked before the current
ThreadContext is destroyed and reset. |
void |
beforeInitialize(ThreadContext threadContext,
ThreadContext parentThreadContext)
Invoked before the current
ThreadContext is initialized and set. |
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, afterInitialize, compareTo
public static final String PROPERTY_HTTP_CLIENTS
public int getPriority()
getPriority
in interface ThreadContextListener
public void beforeInitialize(@Nonnull ThreadContext threadContext, @Nullable ThreadContext parentThreadContext)
ThreadContext
is initialized and set. This method can be used, for example, to
inherit properties from the parent context.beforeInitialize
in interface ThreadContextListener
threadContext
- The ThreadContext
that is initialized and will be set.parentThreadContext
- The existing parent ThreadContext
, or null
if there is currently no
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.