Summary of (important) Methods | |
void |
start()
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. |
void |
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. |
void |
interrupt()
Interrupts this thread. |
boolean |
isInterrupted()
Tests whether this thread has been interrupted. |
void |
join()
Waits for this thread to die. |
void |
join(long millis)
Waits at most millis milliseconds for this thread to
die. |
Static Methods | |
static Thread |
currentThread()
Returns a reference to the currently executing thread object. |
static boolean |
interrupted()
Tests whether the current thread has been interrupted. |
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. |
static void |
yield()
Causes the currently executing thread object to temporarily pause and allow other threads to execute. |
Inherited from Object | |
void |
wait()
Causes current thread to wait until another thread invokes the notify() method or the
notifyAll() method for this object. |
void |
wait(long timeout)
Causes current thread to wait until either another thread invokes the notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed. |
void |
notify()
Wakes up a single thread that is waiting on this object's monitor. |
void |
notifyAll()
Wakes up all threads that are waiting on this object's monitor. |
Utility Methods | |
boolean |
isAlive()
Tests if this thread is alive. |
boolean |
isDaemon()
Tests if this thread is a daemon thread. |
void |
setDaemon(boolean on)
Marks this thread as either a daemon thread or a user thread. |
String |
getName()
Returns this thread's name. |
void |
setName(String name)
Changes the name of this thread to be equal to the argument name . |
static void |
dumpStack()
Prints a stack trace of the current thread. |
String |
toString()
Returns a string representation of this thread, including the thread's name, priority, and thread group. |
Deprecated Methods | |
void |
suspend()
|
void |
resume()
|
void |
stop()
|