Uses of Class
java.lang.Thread
Package
Description
Provides classes that are fundamental to the design of the Java
programming language.
Provides low-level access to memory and functions outside the Java runtime.
Utility classes commonly useful in concurrent programming.
Interfaces and classes providing a framework for locking and waiting
for conditions that is distinct from built-in synchronization and
monitors.
Provides classes and interfaces that deal with editable and noneditable text
components.
-
Uses of Thread in java.lang
Modifier and TypeMethodDescriptionstatic Thread
Thread.currentThread()
Returns the Thread object for the current thread.Creates a newThread
from the current state of the builder and schedules it to execute.static Thread
Thread.startVirtualThread
(Runnable task) Preview.Creates a virtual thread to execute a task and schedules it to execute.Creates a newThread
from the current state of the builder to run the given task.Modifier and TypeMethodDescriptionstatic Map<Thread,
StackTraceElement[]> Thread.getAllStackTraces()
Returns a map of stack traces for all live platform threads.Modifier and TypeMethodDescriptionvoid
Runtime.addShutdownHook
(Thread hook) Registers a new virtual-machine shutdown hook.void
SecurityManager.checkAccess
(Thread t) Deprecated, for removal: This API element is subject to removal in a future version.Throws aSecurityException
if the calling thread is not allowed to modify the thread argument.static int
Copies into the specified array every live platform thread in the current thread's thread group and its subgroups.int
Copies into the specified array every live platform thread in this thread group and its subgroups.int
Copies into the specified array every live platform thread in this thread group.boolean
Runtime.removeShutdownHook
(Thread hook) De-registers a previously-registered virtual-machine shutdown hook.void
Thread.UncaughtExceptionHandler.uncaughtException
(Thread t, Throwable e) Method invoked when the given thread terminates due to the given uncaught exception.void
ThreadGroup.uncaughtException
(Thread t, Throwable e) Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception, and the thread does not have a specificThread.UncaughtExceptionHandler
installed. -
Uses of Thread in java.lang.foreign
Modifier and TypeMethodDescriptionboolean
SegmentScope.isAccessibleBy
(Thread thread) Returnstrue
if the provided thread can access and/or associate segments with this scope.boolean
Arena.isCloseableBy
(Thread thread) Returnstrue
if the provided thread can close this arena. -
Uses of Thread in java.util.concurrent
Modifier and TypeClassDescriptionclass
A thread managed by aForkJoinPool
, which executesForkJoinTask
s.Modifier and TypeMethodDescriptionConstructs a new unstartedThread
to run the given runnable.Modifier and TypeMethodDescriptionprotected Collection<Thread>
Semaphore.getQueuedThreads()
Returns a collection containing threads that may be waiting to acquire.Modifier and TypeMethodDescriptionprotected void
ThreadPoolExecutor.beforeExecute
(Thread t, Runnable r) Method invoked prior to executing the given Runnable in the given thread.void
Performs a timedThread.join
using this time unit. -
Uses of Thread in java.util.concurrent.locks
Modifier and TypeMethodDescriptionprotected final Thread
AbstractOwnableSynchronizer.getExclusiveOwnerThread()
Returns the thread last set bysetExclusiveOwnerThread
, ornull
if never set.final Thread
AbstractQueuedLongSynchronizer.getFirstQueuedThread()
Returns the first (longest-waiting) thread in the queue, ornull
if no threads are currently queued.final Thread
AbstractQueuedSynchronizer.getFirstQueuedThread()
Returns the first (longest-waiting) thread in the queue, ornull
if no threads are currently queued.protected Thread
ReentrantLock.getOwner()
Returns the thread that currently owns this lock, ornull
if not owned.protected Thread
ReentrantReadWriteLock.getOwner()
Returns the thread that currently owns the write lock, ornull
if not owned.Modifier and TypeMethodDescriptionfinal Collection<Thread>
AbstractQueuedLongSynchronizer.getExclusiveQueuedThreads()
Returns a collection containing threads that may be waiting to acquire in exclusive mode.final Collection<Thread>
AbstractQueuedSynchronizer.getExclusiveQueuedThreads()
Returns a collection containing threads that may be waiting to acquire in exclusive mode.protected Collection<Thread>
ReentrantReadWriteLock.getQueuedReaderThreads()
Returns a collection containing threads that may be waiting to acquire the read lock.final Collection<Thread>
AbstractQueuedLongSynchronizer.getQueuedThreads()
Returns a collection containing threads that may be waiting to acquire.final Collection<Thread>
AbstractQueuedSynchronizer.getQueuedThreads()
Returns a collection containing threads that may be waiting to acquire.protected Collection<Thread>
ReentrantLock.getQueuedThreads()
Returns a collection containing threads that may be waiting to acquire this lock.protected Collection<Thread>
ReentrantReadWriteLock.getQueuedThreads()
Returns a collection containing threads that may be waiting to acquire either the read or write lock.protected Collection<Thread>
ReentrantReadWriteLock.getQueuedWriterThreads()
Returns a collection containing threads that may be waiting to acquire the write lock.final Collection<Thread>
AbstractQueuedLongSynchronizer.getSharedQueuedThreads()
Returns a collection containing threads that may be waiting to acquire in shared mode.final Collection<Thread>
AbstractQueuedSynchronizer.getSharedQueuedThreads()
Returns a collection containing threads that may be waiting to acquire in shared mode.protected final Collection<Thread>
AbstractQueuedLongSynchronizer.ConditionObject.getWaitingThreads()
Returns a collection containing those threads that may be waiting on this Condition.final Collection<Thread>
AbstractQueuedLongSynchronizer.getWaitingThreads
(AbstractQueuedLongSynchronizer.ConditionObject condition) Returns a collection containing those threads that may be waiting on the given condition associated with this synchronizer.protected final Collection<Thread>
AbstractQueuedSynchronizer.ConditionObject.getWaitingThreads()
Returns a collection containing those threads that may be waiting on this Condition.final Collection<Thread>
AbstractQueuedSynchronizer.getWaitingThreads
(AbstractQueuedSynchronizer.ConditionObject condition) Returns a collection containing those threads that may be waiting on the given condition associated with this synchronizer.protected Collection<Thread>
ReentrantLock.getWaitingThreads
(Condition condition) Returns a collection containing those threads that may be waiting on the given condition associated with this lock.protected Collection<Thread>
ReentrantReadWriteLock.getWaitingThreads
(Condition condition) Returns a collection containing those threads that may be waiting on the given condition associated with the write lock.Modifier and TypeMethodDescriptionstatic Object
LockSupport.getBlocker
(Thread t) Returns the blocker object supplied to the most recent invocation of a park method that has not yet unblocked, or null if not blocked.final boolean
ReentrantLock.hasQueuedThread
(Thread thread) Queries whether the given thread is waiting to acquire this lock.final boolean
ReentrantReadWriteLock.hasQueuedThread
(Thread thread) Queries whether the given thread is waiting to acquire either the read or write lock.final boolean
Returns true if the given thread is currently queued.final boolean
Returns true if the given thread is currently queued.protected final void
AbstractOwnableSynchronizer.setExclusiveOwnerThread
(Thread thread) Sets the thread that currently owns exclusive access.static void
Makes available the permit for the given thread, if it was not already available. -
Uses of Thread in javax.swing.text
Modifier and TypeMethodDescriptionprotected final Thread
AbstractDocument.getCurrentWriter()
Fetches the current writing thread if there is one.