|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.openfoundation.util.XPThread
public class XPThread
A thread of execution in a program. This class is used to create and control a thread, set its priority and get its status.
Constructor Summary | |
---|---|
XPThread(IXPRunnable runnable)
Initializes a new instance of the XPThread class. |
Method Summary | |
---|---|
static void |
DumpStack()
Print a stack trace of the current thread. |
static XPThread |
GetCurrentThread()
Gets the currently running thread. |
java.lang.String |
GetName()
Gets the name of this thread. |
XPThreadPriority |
GetPriority()
Gets the priority of this thread. |
static java.lang.String |
GetStackTrace()
Get the current thread's stack trace. |
void |
Interrupt()
Interrupts this thread. |
boolean |
IsAlive()
Tests if this thread is alive. |
boolean |
IsBackgroundThread()
Tests if this thread is a background thread. |
void |
Join()
Waits for this thread to die. |
void |
Join(int milliseconds)
Waits at most the given milliseconds for this thread to die. |
void |
Join(int milliseconds,
int nanoseconds)
Waits at most the given milliseconds plus the given nanos nanoseconds for this thread to die. |
void |
Kill()
Deprecated. Deprecated in JDK1.4 - behaviour not guaranteed. DO NOT USE IN PRODUCTION CODE! |
void |
SetBackground(boolean b)
Marks this thread as either a daemon thread or a user thread. |
void |
SetName(java.lang.String name)
Sets the name of this thread. |
void |
SetPriority(XPThreadPriority priority)
Changes the priority of this thread. |
static void |
Sleep(int milliSeconds)
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. |
void |
Start()
Causes this thread to start being execution; the VM calls the run method of this thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XPThread(IXPRunnable runnable)
runnable
- object whose run method is called
XPIllegalArgumentException
- if runnable is nullMethod Detail |
---|
public void Start()
public static XPThread GetCurrentThread()
public static void DumpStack()
public static java.lang.String GetStackTrace()
public void SetName(java.lang.String name)
name
- the name for this thread.public java.lang.String GetName()
public void SetPriority(XPThreadPriority priority)
First the checkAccess
method of this thread is called
with no arguments. This may result in throwing a
XPSecurityException
.
Otherwise, the priority of this thread is set to the smaller of
the specified priority
and the maximum permitted
priority of the thread's thread group.
priority
- priority to set this thread to.public XPThreadPriority GetPriority()
public boolean IsAlive()
public boolean IsBackgroundThread()
public void Join()
public void Join(int milliseconds)
milliseconds
- the time to wait in milliseconds.public void Join(int milliseconds, int nanoseconds)
milliseconds
- the time to wait in milliseconds.nanoseconds
- 0-999999 additional nanoseconds to wait.public static void Sleep(int milliSeconds)
milliSeconds
- the length of time to sleep in milliseconds.
XPThreadInterruptedException
- if interrupted.public void SetBackground(boolean b)
This method must be called before the thread is started.
This method first calls the checkAccess
method
of this thread
with no arguments. This may result in throwing a
SecurityException
(in the current thread).
b
- true will make this thread background.public void Interrupt()
First the checkAccess
method of this thread
is invoked, which may cause a XPSecurityException
to be thrown.
If this thread is blocked in an invocation of the wait()
, wait(long)
, or wait(long, int)
methods of the Object
class, or of the #join()
, #join(long)
, #join(long, int)
, #sleep(long)
, or #sleep(long, int)
,
methods of this class, then its interrupt status will be cleared and it
will receive an XPInterruptedException
.
public void Kill()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |