Interface ContextReference<C>
- Type Parameters:
C- the context type
- All Superinterfaces:
Consumer<C>, Function<C,C>, Supplier<C>, UnaryOperator<C>
- All Known Implementing Classes:
ThreadContextClassLoaderReference, ThreadContextReference
Reference to some context.
- Author:
- Paul Ferraro
-
Method Summary
Modifier and TypeMethodDescriptiondefault Cstatic <C> ContextReference<C> fromThreadLocal(ThreadLocal<C> threadLocal) Creates a context reference from the specifiedThreadLocal.static <C> ContextReference<C> of(AtomicReference<C> reference) Creates a context reference from the specifiedAtomicReference.Returns a context provider for the specified value.
-
Method Details
-
fromThreadLocal
Creates a context reference from the specifiedThreadLocal.- Type Parameters:
C- the context type- Parameters:
threadLocal- a thread local used to store the context- Returns:
- a context reference using the specified
ThreadLocal.
-
of
Creates a context reference from the specifiedAtomicReference.- Type Parameters:
C- the context type- Parameters:
reference- an atomic reference used to store the context- Returns:
- a context reference using the specified
AtomicReference.
-
apply
-
provide
-