Java java.lang Thread fields, constructors, methods, implement or subclass

Example usage for Java java.lang Thread fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.lang Thread.

The text is from its open source code.

Subclass

java.lang.Thread has subclasses.
Click this link to see all its subclasses.

Field

intMIN_PRIORITY
The minimum priority that a thread can have.
intNORM_PRIORITY
The default priority that is assigned to a thread.
intMAX_PRIORITY
The maximum priority that a thread can have.

Constructor

Thread(Runnable target)
Allocates a new Thread object.
Thread(String name)
Allocates a new Thread object.
Thread()
Allocates a new Thread object.
Thread(Runnable target, AccessControlContext acc)
Creates a new Thread that inherits the given AccessControlContext but thread-local variables are not inherited.
Thread(ThreadGroup group, Runnable target)
Allocates a new Thread object.
Thread(ThreadGroup group, String name)
Allocates a new Thread object.
Thread(Runnable target, String name)
Allocates a new Thread object.
Thread(ThreadGroup group, Runnable target, String name)
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 .

Method

intactiveCount()
Returns an estimate of the number of active threads in the current thread's java.lang.ThreadGroup thread group and its subgroups.
voidcheckAccess()
Determines if the currently running thread has permission to modify this thread.
ThreadcurrentThread()
Returns a reference to the currently executing thread object.
voiddumpStack()
Prints a stack trace of the current thread to the standard error stream.
intenumerate(Thread tarray[])
Copies into the specified array every active thread in the current thread's thread group and its subgroups.
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
MapgetAllStackTraces()
Returns a map of stack traces for all live threads.
ClassgetClass()
Returns the runtime class of this Object .
ClassLoadergetContextClassLoader()
Returns the context ClassLoader for this thread.
UncaughtExceptionHandlergetDefaultUncaughtExceptionHandler()
Returns the default handler invoked when a thread abruptly terminates due to an uncaught exception.
longgetId()
Returns the identifier of this Thread.
StringgetName()
Returns this thread's name.
intgetPriority()
Returns this thread's priority.
StackTraceElement[]getStackTrace()
Returns an array of stack trace elements representing the stack dump of this thread.
StategetState()
Returns the state of this thread.
ThreadGroupgetThreadGroup()
Returns the thread group to which this thread belongs.
UncaughtExceptionHandlergetUncaughtExceptionHandler()
Returns the handler invoked when this thread abruptly terminates due to an uncaught exception.
inthashCode()
Returns a hash code value for the object.
booleanholdsLock(Object obj)
Returns true if and only if the current thread holds the monitor lock on the specified object.
voidinterrupt()
Interrupts this thread.
booleaninterrupted()
Tests whether the current thread has been interrupted.
booleanisAlive()
Tests if this thread is alive.
booleanisDaemon()
Tests if this thread is a daemon thread.
booleanisInterrupted()
Tests whether this thread has been interrupted.
voidjoin()
Waits for this thread to die.
voidjoin(long millis, int nanos)
Waits at most millis milliseconds plus nanos nanoseconds for this thread to die.
voidjoin(final long millis)
Waits at most millis milliseconds for this thread to die.
voidnotify()
Wakes up a single thread that is waiting on this object's monitor.
voidnotifyAll()
Wakes up all threads that are waiting on this object's monitor.
voidresume()
Resumes a suspended thread.
voidrun()
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.
voidsetContextClassLoader(ClassLoader cl)
Sets the context ClassLoader for this Thread.
voidsetDaemon(boolean on)
Marks this thread as either a #isDaemon daemon thread or a user thread.
voidsetDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh)
Set the default handler invoked when a thread abruptly terminates due to an uncaught exception, and no other handler has been defined for that thread.
voidsetName(String name)
Changes the name of this thread to be equal to the argument name .
voidsetPriority(int newPriority)
Changes the priority of this thread.
voidsetUncaughtExceptionHandler(UncaughtExceptionHandler eh)
Set the handler invoked when this thread abruptly terminates due to an uncaught exception.
voidsleep(long millis)
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers.
voidstart()
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
voidstop()
Forces the thread to stop executing.
voidsuspend()
Suspends this thread.
StringtoString()
Returns a string representation of this thread, including the thread's name, priority, and thread group.
voidwait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
voidwait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
voidyield()
A hint to the scheduler that the current thread is willing to yield its current use of a processor.