Package io.smallrye.context.impl
Class ThreadContextProviderPlan
java.lang.Object
io.smallrye.context.impl.ThreadContextProviderPlan
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThreadContextProviderPlan(Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> propagatedSet, Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> unchangedSet, Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> clearedSet, boolean enableFastThreadContextProviders) -
Method Summary
Modifier and TypeMethodDescriptionbooleanisEmpty()booleanisFast()intsize()List<org.eclipse.microprofile.context.spi.ThreadContextSnapshot>This helps to optimise construction of CapturedContextState without exposing too many implementation details.voidtakeThreadContextSnapshotsFast(SmallRyeThreadContext threadContext, ThreadLocal<SmallRyeThreadContext> tcTl, ContextHolder contextHolder)
-
Field Details
-
propagatedProviders
-
unchangedProviders
-
clearedProviders
-
-
Constructor Details
-
ThreadContextProviderPlan
public ThreadContextProviderPlan(Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> propagatedSet, Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> unchangedSet, Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> clearedSet, boolean enableFastThreadContextProviders)
-
-
Method Details
-
takeThreadContextSnapshots
public List<org.eclipse.microprofile.context.spi.ThreadContextSnapshot> takeThreadContextSnapshots()This helps to optimise construction of CapturedContextState without exposing too many implementation details. Only useful for snapshots with an empty property set.- Returns:
- a list of snapshots
-
isFast
public boolean isFast()- Returns:
- true if every ThreadContextProvider of this plan implements @{link FastThreadContextProvider}
-
takeThreadContextSnapshotsFast
public void takeThreadContextSnapshotsFast(SmallRyeThreadContext threadContext, ThreadLocal<SmallRyeThreadContext> tcTl, ContextHolder contextHolder) Use this if @{linkisFast()is true (it will throw otherwise) when you want to capture the current context using the fast-path, and feed the captured context in the given @{link ContextHolder}, which must have a size compatible with @{linksize().- Parameters:
threadContext- The thread context settingstcTl- the current ThreadContext thread-local (for contextual settings)contextHolder- the contextual lambda in which we will capture context
-
isEmpty
public boolean isEmpty()- Returns:
- true if there are no captured/cleared contexts (all unchanged). Note: we don't count the contextual ThreadContext because we never want to capture/restore it if it's the only one.
-
size
public int size()- Returns:
- the number of captured/cleared contexts (including the contextual ThreadContext)
-