|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread
public class Thread
A thread of execution (or task). Now handles priorities, daemon threads and interruptions.
Field Summary | |
---|---|
static int |
MAX_PRIORITY
The maximum priority that a thread can have. |
static int |
MIN_PRIORITY
The minimum priority that a thread can have. |
static int |
NORM_PRIORITY
The priority that is assigned to the primordial thread. |
Constructor Summary | |
---|---|
Thread()
|
|
Thread(Runnable target)
|
|
Thread(String name)
|
|
Thread(String name,
Runnable target)
|
Method Summary | |
---|---|
static Thread |
currentThread()
|
int |
getPriority()
|
void |
interrupt()
Set the interrupted flag. |
static boolean |
interrupted()
|
boolean |
isAlive()
|
boolean |
isDaemon()
Set the daemon flag. |
boolean |
isInterrupted()
|
void |
join()
Join not yet implemented |
void |
join(long timeout)
|
void |
run()
When an object implementing interface Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
void |
setDaemon(boolean on)
|
void |
setPriority(int priority)
Set the priority of this thread. |
static void |
sleep(long aMilliseconds)
|
void |
start()
|
static void |
yield()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MIN_PRIORITY
public static final int NORM_PRIORITY
public static final int MAX_PRIORITY
Constructor Detail |
---|
public Thread()
public Thread(String name)
public Thread(Runnable target)
public Thread(String name, Runnable target)
Method Detail |
---|
public final boolean isAlive()
public void run()
Runnable
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
run
in interface Runnable
public final void start()
public static void yield()
public static void sleep(long aMilliseconds) throws InterruptedException
InterruptedException
public static Thread currentThread()
public final int getPriority()
public final void setPriority(int priority)
Threads inherit the priority of their parent. The primordial thread has priority NORM_PRIORITY.
priority
- must be between MIN_PRIORITY and MAX_PRIORITY.public void interrupt()
public static boolean interrupted()
public final boolean isInterrupted()
public final boolean isDaemon()
public final void setDaemon(boolean on)
public final void join() throws InterruptedException
InterruptedException
public final void join(long timeout) throws InterruptedException
InterruptedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |