|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.squawk.VMThread
public final class VMThread
The Squawk implementation of threads.
| Nested Class Summary | |
|---|---|
static class |
VMThread.ExecutionPoint
An ExecutionPoint instance encapsulates the details of a point of execution including the thread, a frame offset, the method to which the frame pertains and the bytecode index of an instruction in the method. |
| 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 default priority that is assigned to a thread. |
| Constructor Summary | |
|---|---|
VMThread(Thread apiThread)
Allocates a new VMThread object to support a given API Thread instance. |
|
| Method Summary | |
|---|---|
static int |
activeCount()
Returns the current number of active threads in the VM. |
static VMThread |
asVMThread(Thread thread)
|
void |
clearBreakpoint()
Clears the object used to report a breakpoint hit. |
void |
clearStep()
Removes the object (if any) that is keeping this thread in single stepping mode. |
static VMThread |
currentThread()
Returns a reference to the currently executing thread object. |
Thread |
getAPIThread()
|
int |
getDebuggerSuspendCount()
Gets the value of the debugger suspension counter for this thread. |
VMThread.ExecutionPoint |
getEventExecutionPoint()
Gets the method and frame context of this thread at which a debugger event occurred. |
int |
getInternalStatus()
Gets the combined values for state and queue. |
Isolate |
getIsolate()
Gets the isolate of the thread. |
String |
getName()
Gets the name of this thread. |
int |
getPriority()
Returns this thread's priority. |
Debugger.SingleStep |
getStep()
Returns the step info object. |
int |
getThreadNumber()
Gets the number of this thread which is only guaranteed to be unique within this thread's isolate. |
void |
interrupt()
Interrupts this thread. |
boolean |
isAlive()
Tests if this thread is alive. |
boolean |
isDaemon()
Gets the daemon state of the thread. |
void |
join()
Waits for this thread to die. |
static void |
monitorNotify(Object object,
boolean notifyAll)
Notify an object. |
static void |
monitorWait(Object object,
long delta)
Wait for an object to be notified. |
int |
resumeForDebugger(boolean forDetach)
Decreases the suspension count of this thread. |
void |
setDaemon(boolean value)
Sets the daemon state of the thread. |
void |
setName(String name)
Sets the name of this thread. |
void |
setPriority(int newPriority)
Changes the priority of this thread. |
void |
setStep(Debugger.SingleStep step)
Sets the object that will put this thread into single stepping mode the next time it is scheduled to run. |
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. |
void |
start()
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. |
int |
suspendForDebugger()
Increases the suspension count of this thread. |
String |
toString()
Returns a string representation of this thread, including a unique number that identifies the thread and the thread's priority. |
static void |
yield()
Causes the currently executing thread object to temporarily pause and allow other threads to execute. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, 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 VMThread(Thread apiThread)
VMThread object to support a given API Thread instance.
This constructor should only be called from a java.lang.Thread constructor.
apiThread - the API thread instance supported by this VM thread| Method Detail |
|---|
public static VMThread currentThread()
public void setDaemon(boolean value)
public boolean isDaemon()
public static void sleep(long millis)
throws InterruptedException
millis - the length of time to sleep in milliseconds.
InterruptedException - if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.Object.notify()public static void yield()
public void start()
run method of this thread.
The result is that two threads are running concurrently: the
current thread (which returns from the call to the
start method) and the other thread (which executes its
run method).
IllegalThreadStateException - if the thread was already started.Thread.run()public final boolean isAlive()
true if this thread is alive;
false otherwise.public final void setPriority(int newPriority)
newPriority - priority to set this thread to
IllegalArgumentException - If the priority is not in the
range MIN_PRIORITY to
MAX_PRIORITY.getPriority(),
Thread.getPriority(),
Thread.MAX_PRIORITY,
Thread.MIN_PRIORITYpublic final int getPriority()
setPriority(int),
Thread.setPriority(int)public static int activeCount()
public final void join()
throws InterruptedException
InterruptedException - if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.public final String getName()
setName(java.lang.String) has never been called for this
thread, the return value will be of the from "Thread-
public final void setName(String name)
name - the new name for this threadpublic String toString()
toString in class Objectpublic final int getDebuggerSuspendCount()
public final int suspendForDebugger()
public final int resumeForDebugger(boolean forDetach)
forDetach - if true, the count is set to 0
public VMThread.ExecutionPoint getEventExecutionPoint()
public final int getInternalStatus()
state and queue.
public final Debugger.SingleStep getStep()
public final void setStep(Debugger.SingleStep step)
step - the details of the requested steppublic final void clearStep()
public void clearBreakpoint()
public Isolate getIsolate()
public Thread getAPIThread()
public static VMThread asVMThread(Thread thread)
public final int getThreadNumber()
public static void monitorWait(Object object,
long delta)
throws InterruptedException
object - the object to wait ondelta - the timeout period
InterruptedException - if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.
public static void monitorNotify(Object object,
boolean notifyAll)
object - the object be notifiednotifyAll - flag to notify all waiting threadspublic void interrupt()
This method does nothing if the current thread is interrupting itself.
If this thread is blocked in an invocation of the Object.wait(),
Object.wait(long), or Object.wait(long, int) methods of the
class, or of the Thread.join(), Thread#join(long),
Thread#join(long, int), Thread.sleep(long), or
Thread#sleep(long, int) methods of this class, then its interrupt
status will be cleared and it will receive an InterruptedException.
If none of the previous conditions hold then this thread's interrupt status will be set.
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||