Top Description Inners Fields Constructors Methods
reactor.core.publisher

pack-priv final Class ContextPropagation

extends Object
Class Inheritance
Imports
java.util.AbstractQueue, .HashMap, .Iterator, .Map, .Queue, java.util.function.BiConsumer, .Function, .Supplier, io.micrometer.context.ContextAccessor, .ContextRegistry, .ContextSnapshot, .ContextSnapshotFactory, .ThreadLocalAccessor, reactor.core.observability.SignalListener, reactor.util.annotation.Nullable, reactor.util.context.Context, .ContextView

Utility private class to detect if the context-propagation library is on the classpath and to offer ContextSnapshot support to Flux and Mono.
Author
Simon Baslé

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv static ContextSnapshotFactory
pack-priv static final Function<Context, Context>
pack-priv static final Function<Context, Context>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static ContextSnapshot
pack-priv static void
configureContextSnapshotFactory(boolean clearMissing)

pack-priv static Function<Context, Context>

Returns:

the Context augmented with captured entries
contextCapture
()

Create a support function that takes a snapshot of thread locals and merges them with the provided Context, resulting in a new Context which includes entries captured from threadLocals by the Context-Propagation API.

pack-priv static Context
pack-priv static <
type of handled values
T
,
the transformed type
R
>
BiConsumer<T, SynchronousSink<R>>

Returns:

potentially wrapped BiConsumer or the original
contextRestoreForHandle
(BiConsumer<T, SynchronousSink<R>>
user provided handler
handler
,
Supplier<Context>
supplies the potentially modified Context to restore ThreadLocal values from
contextSupplier
)

When context-propagation library is available on the classpath, the provided handler will be called with ThreadLocal values restored from the provided Context.

pack-priv static <
type of handled values
T
>
SignalListener<T>

Returns:

potentially wrapped SignalListener or the original
contextRestoreForTap
(final SignalListener<T>
the original SignalListener from the user
original
,
Supplier<Context>
supplies the potentially modified Context to restore ThreadLocal values from
contextSupplier
)

When context-propagation library is available on the classpath, the provided SignalListener will be wrapped with another one that restores ThreadLocal values from the provided Context.

pack-priv static <T> Flux<T>
fluxRestoreThreadLocals(Flux<? extends T> flux)

pack-priv static <T> Mono<T>
monoRestoreThreadLocals(Mono<? extends T> mono)

public static Function<Runnable, Runnable>
private static <V> Map<Object, Object>
setThreadLocal(Object key, V value, ThreadLocalAccessor<?> accessor, Map<Object, Object> previousValues)

pack-priv static <C> ContextSnapshot.Scope
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait