public static interface CorrelationContext.Builder
CorrelationContext class.| Modifier and Type | Method and Description |
|---|---|
CorrelationContext |
build()
Creates a
CorrelationContext from this builder. |
CorrelationContext.Builder |
put(String key,
String value,
EntryMetadata entryMetadata)
Adds the key/value pair and metadata regardless of whether the key is present.
|
CorrelationContext.Builder |
remove(String key)
Removes the key if it exists.
|
CorrelationContext.Builder |
setNoParent()
Sets the option to become a root
CorrelationContext with no parent. |
CorrelationContext.Builder |
setParent(io.grpc.Context context)
Sets the parent
CorrelationContext to use from the specified Context. |
CorrelationContext.Builder |
setParent(CorrelationContext parent)
Sets the parent
CorrelationContext to use. |
CorrelationContext.Builder setParent(CorrelationContext parent)
CorrelationContext to use. If no parent is provided, the value of
CorrelationContextManager.getCurrentContext() at build() time will be used
as parent, unless setNoParent() was called.
This must be used to create a CorrelationContext when manual Context
propagation is used.
If called multiple times, only the last specified value will be used.
parent - the CorrelationContext used as parent, not null.NullPointerException - if parent is null.setNoParent()CorrelationContext.Builder setParent(io.grpc.Context context)
CorrelationContext to use from the specified Context. If no
parent CorrelationContext is provided, the value of CorrelationContextManager.getCurrentContext() at build() time will be used as
parent, unless setNoParent() was called.
If no parent CorrelationContext is available in the specified Context, the
resulting CorrelationContext will become a root instance, as if setNoParent() had been called.
This must be used to create a CorrelationContext when manual Context
propagation is used.
If called multiple times, only the last specified value will be used.
context - the Context.NullPointerException - if context is null.setNoParent()CorrelationContext.Builder setNoParent()
CorrelationContext with no parent. If not
called, the value provided using setParent(CorrelationContext) or otherwise CorrelationContextManager.getCurrentContext() at build() time will be used as
parent.CorrelationContext.Builder put(String key, String value, EntryMetadata entryMetadata)
key - the String key which will be set.value - the String value to set for the given key.entryMetadata - the EntryMetadata associated with this Entry.CorrelationContext.Builder remove(String key)
key - the String key which will be removed.CorrelationContext build()
CorrelationContext from this builder.CorrelationContext with the same entries as this builder.