Class ThreadContextReference<C>

java.lang.Object
org.wildfly.clustering.context.ThreadContextReference<C>
Type Parameters:
C - the context type
All Implemented Interfaces:
Consumer<C>, Function<C,C>, Supplier<C>, UnaryOperator<C>, ContextReference<C>
Direct Known Subclasses:
ThreadContextClassLoaderReference

public class ThreadContextReference<C> extends Object implements ContextReference<C>
Reference that can be associated with an arbitrary thread.
Author:
Paul Ferraro
  • Constructor Details

    • ThreadContextReference

      public ThreadContextReference(Supplier<Thread> reference, Function<Thread,C> accessor, BiConsumer<Thread,C> applicator)
      Constructs a context reference for a provided thread.
      Parameters:
      reference - a provider of a thread
      accessor - a function used to access the context of a thread.
      applicator - a consumer used to apply context to a thread.
  • Method Details

    • accept

      public void accept(C context)
      Specified by:
      accept in interface Consumer<C>
    • get

      public C get()
      Specified by:
      get in interface Supplier<C>