|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread com.isti.util.IstiThread
public class IstiThread
Class IstiThread extends a thread to add additional functionality and to ensure the thread is given a name.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
DEFAULT_TERMINATE_WAIT_TIME
The default terminate wait time in milliseconds. |
protected boolean |
terminateFlag
Flag set true if the thread should be terminated. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
IstiThread(java.lang.Runnable target,
java.lang.String name)
Allocates a new IstiThread object. |
|
IstiThread(java.lang.String name)
Allocates a new IstiThread object. |
|
IstiThread(java.lang.ThreadGroup group,
java.lang.Runnable target,
java.lang.String name)
Allocates a new IstiThread object so that it has
target as its run object, has the specified
name as its name, and belongs to the thread group
referred to by group . |
|
IstiThread(java.lang.ThreadGroup group,
java.lang.String name)
Allocates a new IstiThread object. |
Method Summary | |
---|---|
void |
clearThreadWaitNotifyFlag()
Clears the thread-wait notify flag. |
boolean |
isTerminated()
Tests if this thread is terminated. |
protected static int |
nextThreadNum()
Returns (and increments) the next thread number for autonumbering anonymous threads. |
void |
notifyThread()
Performs a thread-notify. |
void |
start()
Starts this thread if the thread is not terminated and not already alive. |
void |
terminate()
Terminates this thread if the thread is not terminated and alive. |
void |
terminate(long waitTimeMs)
Terminates this thread if the thread is not terminated and alive. |
void |
waitForNotify()
Performs a thread wait. |
boolean |
waitForNotify(long waitTimeMs)
Performs a thread wait, up to the given timeout value. |
void |
waitForTerminate()
Waits (up to 100 milliseconds) for the thread to terminate. |
void |
waitForTerminate(long waitTimeMs)
Waits (up to 'waitTimeMs' milliseconds) for the thread to terminate. |
boolean |
wasStarted()
Determines if the thread was already started. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int DEFAULT_TERMINATE_WAIT_TIME
protected boolean terminateFlag
Constructor Detail |
---|
public IstiThread(java.lang.Runnable target, java.lang.String name)
IstiThread
object. This constructor has
the same effect as IstiThread(null, target, name)
.
target
- the object whose run
method is called.name
- the name of the new thread.public IstiThread(java.lang.String name)
IstiThread
object. This constructor has
the same effect as IstiThread(null, null, name)
.
name
- the name of the new thread.public IstiThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name)
IstiThread
object so that it has
target
as its run object, has the specified
name
as its name, and belongs to the thread group
referred to by group
.
If group
is null
, the group is
set to be the same ThreadGroup as
the thread that is creating the new thread.
If there is a security manager, its checkAccess
method is called with the ThreadGroup as its argument.
This may result in a SecurityException.
If the target
argument is not null
, the
run
method of the target
is called when
this thread is started. If the target argument is
null
, this thread's run
method is called
when this thread is started.
The priority of the newly created thread is normally set equal to the
priority of the thread creating it, that is, the currently running
thread. If the thread is created on the event dispatch thread the
priority of the newly created thread is set to the normal priority.
The method setPriority
may be used to
change the priority to a new value.
The newly created thread is initially marked as being a daemon
thread if and only if the thread creating it is currently marked
as a daemon thread. The method setDaemon
may be used
to change whether or not a thread is a daemon.
group
- the thread group.target
- the object whose run
method is called.name
- the name of the new thread.
java.lang.SecurityException
- if the current thread cannot create a
thread in the specified thread group.public IstiThread(java.lang.ThreadGroup group, java.lang.String name)
IstiThread
object. This constructor has
the same effect as IstiThread(group, null, name)
group
- the thread group.name
- the name of the new thread.
java.lang.SecurityException
- if the current thread cannot create a
thread in the specified thread group.Method Detail |
---|
protected static int nextThreadNum()
public void start()
start
in class java.lang.Thread
wasStarted
public void terminate()
public void terminate(long waitTimeMs)
waitTimeMs
- the maximum number of milliseconds to wait for
the thread to terminate, or 0 to wait indefinitely.public boolean isTerminated()
true
if this thread is terminated;
false
otherwise.public void waitForNotify()
public boolean waitForNotify(long waitTimeMs)
waitTimeMs
- the maximum number of milliseconds to wait for
the thread-notify, or 0 to wait indefinitely.
public void notifyThread()
public void clearThreadWaitNotifyFlag()
public boolean wasStarted()
public void waitForTerminate()
public void waitForTerminate(long waitTimeMs)
waitTimeMs
- the maximum number of milliseconds to wait for
the thread to terminate, or 0 to wait indefinitely.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |