public class ThreadLocalThreadContextFacade extends Object implements ThreadContextFacade
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 and Description |
---|
ThreadLocalThreadContextFacade() |
Modifier and Type | Method and Description |
---|---|
void |
removeCurrentContext()
Removes the current
ThreadContext . |
void |
setCurrentContext(ThreadContext threadContext)
Sets the current
ThreadContext . |
io.vavr.control.Try<ThreadContext> |
tryGetCurrentContext()
Returns a
Try of the current ThreadContext . |
@Nonnull public io.vavr.control.Try<ThreadContext> tryGetCurrentContext()
Try
of the current ThreadContext
.tryGetCurrentContext
in interface ThreadContextFacade
Try
of the current ThreadContext
.public void setCurrentContext(@Nonnull ThreadContext threadContext)
ThreadContext
.setCurrentContext
in interface ThreadContextFacade
public void removeCurrentContext()
ThreadContext
.removeCurrentContext
in interface ThreadContextFacade
Copyright © 2019 SAP SE. All rights reserved.