Uses of Class
java.lang.Thread
Packages that useThread Package Description java.lang Provides classes that are fundamental to the design of the Java programming language.java.util.concurrent Utility classes commonly useful in concurrent programming.java.util.concurrent.locks Interfaces and classes providing a framework for locking and waiting for conditions that is distinct from built-in synchronization and monitors.javax.swing.text Provides classes and interfaces that deal with editable and noneditable text components.Uses ofThread injava.lang
Methods injava.lang that returnThread Modifier and Type Method Description staticThreadThread. currentThread()Returns a reference to the currently executing thread object.Methods injava.lang that return types with arguments of typeThread Modifier and Type Method Description staticMap<Thread,StackTraceElement[]>Thread. getAllStackTraces()Returns a map of stack traces for all live threads.Methods injava.lang with parameters of typeThread Modifier and Type Method Description voidRuntime. addShutdownHook(Thread hook)Registers a new virtual-machine shutdown hook.voidSecurityManager. checkAccess(Thread t)Throws aSecurityExceptionif the calling thread is not allowed to modify the thread argument.static intThread. enumerate(Thread[] tarray)Copies into the specified array every active thread in the current thread's thread group and its subgroups.intThreadGroup. enumerate(Thread[] list)Copies into the specified array every active thread in this thread group and its subgroups.intThreadGroup. enumerate(Thread[] list, boolean recurse)Copies into the specified array every active thread in this thread group.booleanRuntime. removeShutdownHook(Thread hook)De-registers a previously-registered virtual-machine shutdown hook.voidThread.UncaughtExceptionHandler. uncaughtException(Thread t,Throwable e)Method invoked when the given thread terminates due to the given uncaught exception.voidThreadGroup. 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.UncaughtExceptionHandlerinstalled.Uses ofThread injava.util.concurrent
Subclasses ofThread injava.util.concurrent Modifier and Type Class Description classForkJoinWorkerThreadA thread managed by aForkJoinPool, which executesForkJoinTasks.Methods injava.util.concurrent that returnThread Modifier and Type Method Description ThreadThreadFactory. newThread(Runnable r)Constructs a newThread.Methods injava.util.concurrent that return types with arguments of typeThread Modifier and Type Method Description protectedCollection<Thread>Semaphore. getQueuedThreads()Returns a collection containing threads that may be waiting to acquire.Methods injava.util.concurrent with parameters of typeThread Modifier and Type Method Description protected voidThreadPoolExecutor. beforeExecute(Thread t,Runnable r)Method invoked prior to executing the given Runnable in the given thread.voidTimeUnit. timedJoin(Thread thread, long timeout)Performs a timedThread.joinusing this time unit.Uses ofThread injava.util.concurrent.locks
Methods injava.util.concurrent.locks that returnThread Modifier and Type Method Description protectedThreadAbstractOwnableSynchronizer. getExclusiveOwnerThread()Returns the thread last set bysetExclusiveOwnerThread, ornullif never set.ThreadAbstractQueuedLongSynchronizer. getFirstQueuedThread()Returns the first (longest-waiting) thread in the queue, ornullif no threads are currently queued.ThreadAbstractQueuedSynchronizer. getFirstQueuedThread()Returns the first (longest-waiting) thread in the queue, ornullif no threads are currently queued.protectedThreadReentrantLock. getOwner()Returns the thread that currently owns this lock, ornullif not owned.protectedThreadReentrantReadWriteLock. getOwner()Returns the thread that currently owns the write lock, ornullif not owned.Methods injava.util.concurrent.locks that return types with arguments of typeThread Modifier and Type Method Description Collection<Thread>AbstractQueuedLongSynchronizer. getExclusiveQueuedThreads()Returns a collection containing threads that may be waiting to acquire in exclusive mode.Collection<Thread>AbstractQueuedSynchronizer. getExclusiveQueuedThreads()Returns a collection containing threads that may be waiting to acquire in exclusive mode.protectedCollection<Thread>ReentrantReadWriteLock. getQueuedReaderThreads()Returns a collection containing threads that may be waiting to acquire the read lock.Collection<Thread>AbstractQueuedLongSynchronizer. getQueuedThreads()Returns a collection containing threads that may be waiting to acquire.Collection<Thread>AbstractQueuedSynchronizer. getQueuedThreads()Returns a collection containing threads that may be waiting to acquire.protectedCollection<Thread>ReentrantLock. getQueuedThreads()Returns a collection containing threads that may be waiting to acquire this lock.protectedCollection<Thread>ReentrantReadWriteLock. getQueuedThreads()Returns a collection containing threads that may be waiting to acquire either the read or write lock.protectedCollection<Thread>ReentrantReadWriteLock. getQueuedWriterThreads()Returns a collection containing threads that may be waiting to acquire the write lock.Collection<Thread>AbstractQueuedLongSynchronizer. getSharedQueuedThreads()Returns a collection containing threads that may be waiting to acquire in shared mode.Collection<Thread>AbstractQueuedSynchronizer. getSharedQueuedThreads()Returns a collection containing threads that may be waiting to acquire in shared mode.protectedCollection<Thread>AbstractQueuedLongSynchronizer.ConditionObject. getWaitingThreads()Returns a collection containing those threads that may be waiting on this Condition.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.protectedCollection<Thread>AbstractQueuedSynchronizer.ConditionObject. getWaitingThreads()Returns a collection containing those threads that may be waiting on this Condition.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.protectedCollection<Thread>ReentrantLock. getWaitingThreads(Condition condition)Returns a collection containing those threads that may be waiting on the given condition associated with this lock.protectedCollection<Thread>ReentrantReadWriteLock. getWaitingThreads(Condition condition)Returns a collection containing those threads that may be waiting on the given condition associated with the write lock.Methods injava.util.concurrent.locks with parameters of typeThread Modifier and Type Method Description staticObjectLockSupport. 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.booleanReentrantLock. hasQueuedThread(Thread thread)Queries whether the given thread is waiting to acquire this lock.booleanReentrantReadWriteLock. hasQueuedThread(Thread thread)Queries whether the given thread is waiting to acquire either the read or write lock.booleanAbstractQueuedLongSynchronizer. isQueued(Thread thread)Returns true if the given thread is currently queued.booleanAbstractQueuedSynchronizer. isQueued(Thread thread)Returns true if the given thread is currently queued.protected voidAbstractOwnableSynchronizer. setExclusiveOwnerThread(Thread thread)Sets the thread that currently owns exclusive access.static voidLockSupport. unpark(Thread thread)Makes available the permit for the given thread, if it was not already available.Uses ofThread injavax.swing.text
Methods injavax.swing.text that returnThread Modifier and Type Method Description protectedThreadAbstractDocument. getCurrentWriter()Fetches the current writing thread if there is one.