Class AtomixThread

java.lang.Object
java.lang.Thread
io.atomix.utils.concurrent.AtomixThread
All Implemented Interfaces:
Runnable

public class AtomixThread extends Thread
Atomix thread.

The Atomix thread primarily serves to store a ThreadContext for the current thread. The context is stored in a WeakReference in order to allow the thread to be garbage collected.

There is no ThreadContext associated with the thread when it is first created. It is the responsibility of thread creators to set the thread context when appropriate.

Author:
Jordan Halterman
  • Constructor Details

    • AtomixThread

      public AtomixThread(Runnable target)
  • Method Details

    • getContext

      public ThreadContext getContext()
      Returns the thread context.
      Returns:
      The thread ThreadContext or null if no context has been configured.
    • setContext

      public void setContext(ThreadContext context)
      Sets the thread context.
      Parameters:
      context - The thread context.