|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--jj2000.j2k.util.ThreadPool.ThreadPoolThread
The threads that are managed by the pool.
Field Summary | |
private boolean |
doNotifyAll
|
private java.lang.Object |
lock
|
private java.lang.Runnable |
target
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ThreadPool.ThreadPoolThread(int idx,
java.lang.String name)
Creates a ThreadPoolThread object, setting its name according to the given 'idx', daemon type and the priority to the one of the pool. |
Method Summary | |
void |
run()
The method that is run by the thread. |
(package private) void |
setTarget(java.lang.Runnable target,
java.lang.Object lock,
boolean notifyAll)
Assigns a target to this thread, with an optional notify lock and a notify mode. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.lang.Runnable target
private java.lang.Object lock
private boolean doNotifyAll
Constructor Detail |
public ThreadPool.ThreadPoolThread(int idx, java.lang.String name)
idx
- The index of this thread in the poolname
- The name of the threadMethod Detail |
public void run()
An interrupt on this thread has no effect other than forcing a check on the target. Normally the target is checked every time the thread is woken up by notify, no interrupts should be done.
Any exception thrown by the target's 'run()' method is catched and this thread is not affected, except for 'ThreadDeath'. If a 'ThreadDeath' exception is catched a warning message is printed by the 'FacilityManager' and the exception is propagated up. For exceptions which are subclasses of 'Error' or 'RuntimeException' the corresponding error condition is set and this thread is not affected. For any other exceptions a new 'RuntimeException' is created and the error condition is set, this thread is not affected.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
void setTarget(java.lang.Runnable target, java.lang.Object lock, boolean notifyAll)
target
- The runnable object containing the 'run()' method to
run.lock
- An object on which notify will be called once the
target's run method has finished. A thread to be notified should be
waiting on that object. If null no thread is notified.notifyAll
- If true 'notifyAll()', instead of 'notify()', will
be called on tghe lock.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |