Interface Context
- All Known Implementing Classes:
ContextImpl
public interface Context
The diagnostics Context is the object through which
diagnostics data relevant to the current task are
read and written.
A task is a unit of work being executed by the java
process. Examples include
- responding to an external stimulus such as a simple http request or web-service request
- executing a scheduled job
- Location:
Locationprovides correlation between a task and its sub-task(s) - Name-value pairs: Arbitrary name-value pairs that may
be reported in diagnostics features such as logging,
flight recordings, request sampling and tracing and so on.
- Name: The name should use the standard java naming convention including package name. The name should be sufficiently clear that consumers of the data (e.g. the readers of log files, i.e. developers!) have some good starting point when interpreting the diagnostics data.
- Value: The value should be as concise as possible.
ContextManager.- See Also:
-
Location
-
Method Summary
Modifier and TypeMethodDescription<T> TGet a named value from this Context.org.glassfish.contextpropagation.LocationGet the Location of this Context.<T> TPut a named value in this Context.<T> TPut a named value in this Context.<T> TRemove the named value from this Context.
-
Method Details
-
getLocation
org.glassfish.contextpropagation.Location getLocation()Get the Location of this Context. -
put
Put a named value in this Context.- Parameters:
name- The name of the item of data.value- The value of item of data.propagates- If true then the data item will be propagated.- Returns:
- The previous value associated with this name (if there is one).
-
put
Put a named value in this Context.- Parameters:
name- The name of the item of data.value- The value of item of data.propagates- If true then the data item will be propagated.- Returns:
- The previous value associated with this name (if there is one).
-
remove
Remove the named value from this Context.- Parameters:
name- The name of the item of data.- Returns:
- The value being removed if there is one, otherwise null.
-
get
Get a named value from this Context.- Parameters:
name- The name of the item of data.- Returns:
- The value associated with this name if there is one, otherwise null.
-