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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns an instanceThreadContextor null.voidRemoves the currentThreadContext.voidsetCurrentContext(ThreadContext threadContext) Sets the currentThreadContext.io.vavr.control.Try<ThreadContext>Returns aTryof the currentThreadContext.
-
Constructor Details
-
ThreadLocalThreadContextFacade
public ThreadLocalThreadContextFacade()
-
-
Method Details
-
tryGetCurrentContext
Description copied from interface:ThreadContextFacadeReturns aTryof the currentThreadContext.- Specified by:
tryGetCurrentContextin interfaceThreadContextFacade- Returns:
- A
Tryof the currentThreadContext.
-
setCurrentContext
Description copied from interface:ThreadContextFacadeSets the currentThreadContext.- Specified by:
setCurrentContextin interfaceThreadContextFacade- Parameters:
threadContext- TheThreadContextto set.
-
removeCurrentContext
public void removeCurrentContext()Description copied from interface:ThreadContextFacadeRemoves the currentThreadContext.- Specified by:
removeCurrentContextin interfaceThreadContextFacade
-
getCurrentContextOrNull
Description copied from interface:ThreadContextFacadeReturns an instanceThreadContextor null.- Specified by:
getCurrentContextOrNullin interfaceThreadContextFacade- Returns:
- A
ThreadContextor null.
-