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 ContextManager
CONTEXT_MANAGER
private static java.util.logging.Logger
LOGGER
-
Constructor Summary
Constructors Modifier Constructor Description private
ContextHandleUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ContextHandle
currentContext()
static Span
getValue(ContextHandle context)
Returns the value from the specifiedContextHandle
.private static ContextManager
loadContextManager(java.lang.ClassLoader classLoader)
static io.grpc.Context
tryExtractGrpcContext(ContextHandle handle)
Attempts to pull theContext
out of an OpenCensusContextHandle
.static ContextHandle
withValue(ContextHandle context, Span span)
Creates a newContextHandle
with 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 newContextHandle
with 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 theContext
out of an OpenCensusContextHandle
.- Returns:
- The context, or null if not a GRPC backed context handle.
-
-