Class ThreadContextAccessor
java.lang.Object
com.sap.cloud.sdk.cloudplatform.thread.ThreadContextAccessor
Accessor for the current
ThreadContext.-
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadContextReturns the currentThreadContext.static ThreadContextReturns the currentThreadContextor null, if this is not possible.static ThreadContextFacadeReturns theThreadContextFacadeinstance.static voidsetThreadContextFacade(ThreadContextFacade threadContextFacade) Replaces the defaultThreadContextFacadeinstance.static io.vavr.control.Try<ThreadContext>Returns aTryof the currentThreadContext.static io.vavr.control.Try<ThreadContextFacade>Returns aTryof theThreadContextFacadeinstance.
-
Method Details
-
getThreadContextFacade
Returns theThreadContextFacadeinstance.- Returns:
- The
ThreadContextFacadeinstance, ornull.
-
tryGetThreadContextFacade
Returns aTryof theThreadContextFacadeinstance.- Returns:
- A
Tryof theThreadContextFacadeinstance.
-
setThreadContextFacade
Replaces the defaultThreadContextFacadeinstance.- Parameters:
threadContextFacade- An instance ofThreadContextFacade. Usenullto reset the facade.
-
getCurrentContext
Returns the currentThreadContext.- Returns:
- The current
ThreadContext. - Throws:
ThreadContextAccessException- If the currentThreadContextcannot be accessed.
-
tryGetCurrentContext
Returns aTryof the currentThreadContext.- Returns:
- A
Tryof the currentThreadContext.
-
getCurrentContextOrNull
Returns the currentThreadContextor null, if this is not possible.- Returns:
- The current
ThreadContextor null. - Since:
- 4.3.0
-