Class ThreadContextAccessor
java.lang.Object
com.sap.cloud.sdk.cloudplatform.thread.ThreadContextAccessor
Accessor for the current
ThreadContext
.-
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadContext
Returns the currentThreadContext
.static ThreadContext
Returns the currentThreadContext
or null, if this is not possible.static ThreadContextFacade
Returns theThreadContextFacade
instance.static void
setThreadContextFacade
(ThreadContextFacade threadContextFacade) Replaces the defaultThreadContextFacade
instance.static io.vavr.control.Try<ThreadContext>
Returns aTry
of the currentThreadContext
.static io.vavr.control.Try<ThreadContextFacade>
Returns aTry
of theThreadContextFacade
instance.
-
Method Details
-
getThreadContextFacade
Returns theThreadContextFacade
instance.- Returns:
- The
ThreadContextFacade
instance, ornull
.
-
tryGetThreadContextFacade
Returns aTry
of theThreadContextFacade
instance.- Returns:
- A
Try
of theThreadContextFacade
instance.
-
setThreadContextFacade
Replaces the defaultThreadContextFacade
instance.- Parameters:
threadContextFacade
- An instance ofThreadContextFacade
. Usenull
to reset the facade.
-
getCurrentContext
Returns the currentThreadContext
.- Returns:
- The current
ThreadContext
. - Throws:
ThreadContextAccessException
- If the currentThreadContext
cannot be accessed.
-
tryGetCurrentContext
Returns aTry
of the currentThreadContext
.- Returns:
- A
Try
of the currentThreadContext
.
-
getCurrentContextOrNull
Returns the currentThreadContext
or null, if this is not possible.- Returns:
- The current
ThreadContext
or null. - Since:
- 4.3.0
-