Package io.grpc
Class ThreadLocalContextStorage
java.lang.Object
io.grpc.Context.Storage
io.grpc.ThreadLocalContextStorage
A
ThreadLocal
-based context storage implementation. Used by default.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ThreadLocal
<Context> Currently bound context.private static final Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncurrent()
ImplementsContext.current()
.void
ImplementsContext.detach(io.grpc.Context)
.ImplementsContext.attach()
.
-
Field Details
-
log
-
localContext
Currently bound context.
-
-
Constructor Details
-
ThreadLocalContextStorage
ThreadLocalContextStorage()
-
-
Method Details
-
doAttach
Description copied from class:Context.Storage
ImplementsContext.attach()
.Caution:
Context.attach()
interprets a return value ofnull
to mean the same thing asContext.ROOT
.See also:
Context.Storage.current()
.- Specified by:
doAttach
in classContext.Storage
- Parameters:
toAttach
- the context to be attached- Returns:
- A
Context
that should be passed back intoContext.Storage.detach(Context, Context)
as thetoRestore
parameter.null
is a valid return value, but see caution note.
-
detach
Description copied from class:Context.Storage
ImplementsContext.detach(io.grpc.Context)
.- Specified by:
detach
in classContext.Storage
- Parameters:
toDetach
- the context to be detached. Should be, or be equivalent to, the current context of the current scopetoRestore
- the context to be the current. Should be, or be equivalent to, the context of the outer scope
-
current
Description copied from class:Context.Storage
ImplementsContext.current()
.Caution:
Context
interprets a return value ofnull
to mean the same thing asContext.ROOT
.See also
Context.Storage.doAttach(Context)
.- Specified by:
current
in classContext.Storage
- Returns:
- The context of the current scope.
null
is a valid return value, but see caution note.
-