Package io.opencensus.trace.unsafe
Class ContextHandleUtils
- java.lang.Object
-
- io.opencensus.trace.unsafe.ContextHandleUtils
-
public class ContextHandleUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static ContextManagerCONTEXT_MANAGERprivate static java.util.logging.LoggerLOGGER
-
Constructor Summary
Constructors Modifier Constructor Description privateContextHandleUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ContextHandlecurrentContext()static SpangetValue(ContextHandle context)Returns the value from the specifiedContextHandle.private static ContextManagerloadContextManager(java.lang.ClassLoader classLoader)static io.grpc.ContexttryExtractGrpcContext(ContextHandle handle)Attempts to pull theContextout of an OpenCensusContextHandle.static ContextHandlewithValue(ContextHandle context, Span span)Creates a newContextHandlewith the given value set.
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
CONTEXT_MANAGER
private static final ContextManager CONTEXT_MANAGER
-
-
Method Detail
-
loadContextManager
private static ContextManager loadContextManager(@Nullable java.lang.ClassLoader classLoader)
-
currentContext
public static ContextHandle currentContext()
-
withValue
public static ContextHandle withValue(ContextHandle context, @Nullable Span span)
Creates a newContextHandlewith the given value set.- Parameters:
context- the parentContextHandle.span- the value to be set.- Returns:
- a new context with the given value set.
-
getValue
public static Span getValue(ContextHandle context)
Returns the value from the specifiedContextHandle.- Parameters:
context- the specifiedContextHandle.- Returns:
- the value from the specified
ContextHandle.
-
tryExtractGrpcContext
@Nullable public static io.grpc.Context tryExtractGrpcContext(ContextHandle handle)
Attempts to pull theContextout of an OpenCensusContextHandle.- Returns:
- The context, or null if not a GRPC backed context handle.
-
-