public abstract class Context<T>
extends java.lang.Object
| Constructor and Description |
|---|
Context() |
| Modifier and Type | Method and Description |
|---|---|
T |
cast(java.lang.Object context)
Cast an untyped object to the context type.
|
abstract T |
get()
Get the current context object for propagation.
|
T |
join(T firstContext,
T secondContext)
Join two propagated context objects (such as for Futures).
|
abstract void |
set(T context)
Set the propagated context object into the current scope.
|
public abstract T get()
Note: implementations can return null to propagate empty context.
public abstract void set(T context)
Note: implementations should handle null as empty context.
context - propagated context object, from associated getpublic T join(T firstContext, T secondContext)
Default implementation prefers the second context (for Futures, the completing context).
Override this method to actually join the contexts. Note: implementations should handle null as empty context.
firstContext - first propagated context object, from associated getsecondContext - second propagated context object, from associated getpublic T cast(java.lang.Object context)
context - context objectCinnamon API. Copyright (c) 2015–2021 Lightbend.