Class ThreadLocalThreadContextFacade
java.lang.Object
com.sap.cloud.sdk.cloudplatform.thread.ThreadLocalThreadContextFacade
- All Implemented Interfaces:
ThreadContextFacade
Implementation of
ThreadContextFacade
that internally uses ThreadLocal
to provide access to the
respective ThreadContext
.
Important: This implementation should only be used when relying on container-managed threads only. In case you use a framework that manages threads, you have to rely on an implementation that is adjusted to your framework.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns an instanceThreadContext
or null.void
Removes the currentThreadContext
.void
setCurrentContext
(ThreadContext threadContext) Sets the currentThreadContext
.io.vavr.control.Try<ThreadContext>
Returns aTry
of the currentThreadContext
.
-
Constructor Details
-
ThreadLocalThreadContextFacade
public ThreadLocalThreadContextFacade()
-
-
Method Details
-
tryGetCurrentContext
Description copied from interface:ThreadContextFacade
Returns aTry
of the currentThreadContext
.- Specified by:
tryGetCurrentContext
in interfaceThreadContextFacade
- Returns:
- A
Try
of the currentThreadContext
.
-
setCurrentContext
Description copied from interface:ThreadContextFacade
Sets the currentThreadContext
.- Specified by:
setCurrentContext
in interfaceThreadContextFacade
- Parameters:
threadContext
- TheThreadContext
to set.
-
removeCurrentContext
public void removeCurrentContext()Description copied from interface:ThreadContextFacade
Removes the currentThreadContext
.- Specified by:
removeCurrentContext
in interfaceThreadContextFacade
-
getCurrentContextOrNull
Description copied from interface:ThreadContextFacade
Returns an instanceThreadContext
or null.- Specified by:
getCurrentContextOrNull
in interfaceThreadContextFacade
- Returns:
- A
ThreadContext
or null.
-