Share via


Thread Members

Class Overview | This Package | All Packages

Fields

Name Description
MAX_PRIORITY The maximum priority that a thread can have.
MIN_PRIORITY The minimum priority that a thread can have.
NORM_PRIORITY The default priority that is assigned to a thread.

Constructors

Name Description
Thread() Allocates a new Thread object.
Thread(Runnable) Allocates a new Thread object.
Thread(Runnable, String) Allocates a new Thread object.
Thread(String) Allocates a new Thread object.
Thread(ThreadGroup, Runnable) Allocates a new Thread object.
Thread(ThreadGroup, Runnable, String) Allocates a new Thread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.
Thread(ThreadGroup, String) Allocates a new Thread object.

Methods

Name Description
activeCount() Returns the current number of active threads in this thread group.
checkAccess() Determines if the currently running thread has permission to modify this thread.
countStackFrames() Counts the number of stack frames in this thread.
currentThread() Returns a reference to the currently executing thread object.
destroy() Destroys this thread, without any cleanup.
dumpStack() Prints a stack trace of the current thread.
enumerate(Thread[]) Copies into the specified array every active thread in this thread group and its subgroups.
getName() Returns this thread's name.
getPriority() Returns this thread's priority.
getThreadGroup() Returns this thread's thread group.
interrupt() Interrupts this thread.
interrupted() Tests if the current thread has been interrupted.
isAlive() Tests if this thread is alive.
isDaemon() Tests if this thread is a daemon thread.
isInterrupted() Tests if the current thread has been interrupted.
join() Waits for this thread to die.
join(long) Waits at most millis milliseconds for this thread to die.
join(long, int) Waits at most millis milliseconds plus nanos nanoseconds for this thread to die.
resume() Resumes a suspended thread.
run() If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.
setDaemon(boolean) Marks this thread as either a daemon thread or a user thread.
setName(String) Changes the name of this thread to be equal to the argument name.
setPriority(int) Changes the priority of this thread.
sleep(long) Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds.
sleep(long, int) Causes the currently executing thread to sleep (cease execution) for the specified number of milliseconds plus the specified number of nanoseconds.
start() Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
stop() Forces the thread to stop executing.
stop(Throwable) Forces the thread to stop executing.
suspend() Suspends this thread.
toString() Returns a string representation of this thread, including the thread's name, priority, and thread group.
yield() Causes the currently executing thread object to temporarily pause and allow other threads to execute.