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().voidImplementsContext.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.StorageImplementsContext.attach().Caution:
Context.attach()interprets a return value ofnullto mean the same thing asContext.ROOT.See also:
Context.Storage.current().- Specified by:
doAttachin classContext.Storage- Parameters:
toAttach- the context to be attached- Returns:
- A
Contextthat should be passed back intoContext.Storage.detach(Context, Context)as thetoRestoreparameter.nullis a valid return value, but see caution note.
-
detach
Description copied from class:Context.StorageImplementsContext.detach(io.grpc.Context).- Specified by:
detachin 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.StorageImplementsContext.current().Caution:
Contextinterprets a return value ofnullto mean the same thing asContext.ROOT.See also
Context.Storage.doAttach(Context).- Specified by:
currentin classContext.Storage- Returns:
- The context of the current scope.
nullis a valid return value, but see caution note.
-