Class ThreadContextProviderPlan


  • public class ThreadContextProviderPlan
    extends Object
    • Field Detail

      • propagatedProviders

        public final Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> propagatedProviders
      • unchangedProviders

        public final Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> unchangedProviders
      • clearedProviders

        public final Set<org.eclipse.microprofile.context.spi.ThreadContextProvider> clearedProviders
    • Constructor Detail

      • 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 Detail

      • 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 @{link isFast() 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 @{link size().
        Parameters:
        threadContext - The thread context settings
        tcTl - 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)