Class Context<T>
- java.lang.Object
-
- com.lightbend.cinnamon.propagation.Context<T>
-
public abstract class Context<T> extends java.lang.ObjectContext SPI for automatic context propagation.
-
-
Constructor Summary
Constructors Constructor Description Context()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tcast(java.lang.Object context)Cast an untyped object to the context type.abstract Tget()Get the current context object for propagation.Tjoin(T firstContext, T secondContext)Join two propagated context objects (such as for Futures).abstract voidset(T context)Set the propagated context object into the current scope.
-
-
-
Method Detail
-
get
public abstract T get()
Get the current context object for propagation.Note: implementations can return
nullto propagate empty context.- Returns:
- current context object
-
set
public abstract void set(T context)
Set the propagated context object into the current scope.Note: implementations should handle
nullas empty context.- Parameters:
context- propagated context object, from associatedget()
-
join
public T join(T firstContext, T secondContext)
Join two propagated context objects (such as for Futures).Default implementation prefers the second context (for Futures, the completing context). Override this method to actually join the contexts. Note: implementations should handle
nullas empty context.
-
cast
public T cast(java.lang.Object context)
Cast an untyped object to the context type.- Parameters:
context- context object- Returns:
- context object as context type
-
-