Package io.atomix.utils.concurrent
Class AtomixThread
java.lang.Object
java.lang.Thread
io.atomix.utils.concurrent.AtomixThread
- All Implemented Interfaces:
Runnable
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
-
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 -
Method Summary
Modifier and TypeMethodDescriptionReturns 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 Details
-
AtomixThread
-
-
Method Details
-
getContext
Returns the thread context.- Returns:
- The thread
ThreadContextornullif no context has been configured.
-
setContext
Sets the thread context.- Parameters:
context- The thread context.
-