img
Method
Description
final boolean isAlive( )
Returns true if the thread is still active. Other wise,
it returns false.
final boolean isDaemon( )
Returns true if the thread is a daemon thread.
Other wise, it returns false.
boolean isInterrupted( )
Returns true if the thread is interrupted.
Other wise, it returns false.
final void join( )
Waits until the thread terminates.
throws InterruptedException
final void join(long milliseconds)
Waits up to the specified number of milliseconds
throws InterruptedException
for the thread on which it is called to terminate.
final void join(long milliseconds,
Waits up to the specified number of milliseconds
int nanoseconds)
plus nanoseconds for the thread on which it is
throws InterruptedException
called to terminate.
void run( )
Begins execution of a thread.
void setContextClassLoader(ClassLoader cl) Sets the class loader that will be used by the
invoking thread to cl.
final void setDaemon(boolean state)
Flags the thread as a daemon thread.
Sets the default uncaught exception handler to e.
static void
setDefaultUncaughtExceptionHandler(
Thread.UncaughtExceptionHandler e)
final void setName(String threadName)
Sets the name of the thread to that specified by
threadName.
final void setPriority(int priority)
Sets the priority of the thread to that specified by
priority.
void
Sets the invoking thread's default uncaught
exception handler to e.
setUncaughtExceptionHandler(
Thread.UncaughtExceptionHandler e)
static void sleep(long milliseconds)
Suspends execution of the thread for the specified
throws InterruptedException
number of milliseconds.
static void sleep(long milliseconds,
Suspends execution of the thread for the specified
int nanoseconds)
number of milliseconds plus nanoseconds.
throws InterruptedException
void star t( )
Star ts execution of the thread.
String toString( )
Returns the string equivalent of a thread.
static void yield( )
The calling thread yields the CPU to another thread.
TABLE 16-17
The Methods Defined by Thread (continued )
ThreadGroup
ThreadGroup creates a group of threads. It defines these two constructors:
ThreadGroup(String groupName)
ThreadGroup(ThreadGroup parentOb, String groupName)
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home