Package io.atomix.utils.concurrent
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
ThreadContextfor the current thread. The context is stored in aWeakReferencein order to allow the thread to be garbage collected.There is no
ThreadContextassociated with the thread when it is first created. It is the responsibility of thread creators tosetthe thread context when appropriate.- Author:
- Jordan Halterman
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description AtomixThread(Runnable target)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadContextgetContext()Returns the thread context.voidsetContext(ThreadContext context)Sets the thread context.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
AtomixThread
public AtomixThread(Runnable target)
-
-
Method Detail
-
getContext
public ThreadContext getContext()
Returns the thread context.- Returns:
- The thread
ThreadContextornullif no context has been configured.
-
setContext
public void setContext(ThreadContext context)
Sets the thread context.- Parameters:
context- The thread context.
-
-