Package io.grpc

Class Context.Storage

  • Enclosing class:
    Context

    public abstract static class Context.Storage
    extends java.lang.Object
    Defines the mechanisms for attaching and detaching the "current" context. The constructor for extending classes must not trigger any activity that can use Context, which includes logging, otherwise it can trigger an infinite initialization loop. Extending classes must not assume that only one instance will be created; Context guarantees it will only use one instance, but it may create multiple and then throw away all but one.

    The default implementation will put the current context in a ThreadLocal. If an alternative implementation named io.grpc.override.ContextStorageOverride exists in the classpath, it will be used instead of the default implementation.

    This API is experimental and subject to change.

    • Constructor Detail

      • Storage

        public Storage()
    • Method Detail

      • detach

        public abstract void detach​(Context toDetach,
                                    Context toRestore)
        Parameters:
        toDetach - the context to be detached. Should be, or be equivalent to, the current context of the current scope
        toRestore - the context to be the current. Should be, or be equivalent to, the context of the outer scope