|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.msi.threadpuddle.ThreadPuddleImpl
| Field Summary | |
private boolean |
debug
|
private java.util.Vector |
pendingJobs
|
private int |
threadCount
|
private java.util.Vector |
threads
|
| Constructor Summary | |
ThreadPuddleImpl(java.util.Properties props)
ThreadPuddleImpl - create a new
ThreadPuddleImpl initializing state from
the supplied properties. |
|
| Method Summary | |
void |
addJob(java.lang.Runnable job)
addJob put a new job into the work queue
and notify the next available thread. |
int |
findMe()
findMe called by a pool thread to find itself in the
vector of available threads. |
private int |
firstIdleThread()
firstIdleThread - Called by the thread
pool to find the first idle thread. |
java.lang.Runnable |
getJob()
getJob retrieve the next available job. |
State |
getState()
getState return the current snapshot
of the puddle state. |
void |
idleMe()
idleMe mark the current thread as idle. |
private int |
idleThreads()
|
int |
jobCount()
|
void |
removeMe()
removeMe called by a pool thread to remove itself from
the vector of available threads |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int threadCount
private java.util.Vector pendingJobs
private java.util.Vector threads
private boolean debug
| Constructor Detail |
public ThreadPuddleImpl(java.util.Properties props)
throws java.lang.NumberFormatException,
java.lang.IllegalArgumentException
ThreadPuddleImpl - create a new
ThreadPuddleImpl initializing state from
the supplied properties.
| Method Detail |
public int jobCount()
public void addJob(java.lang.Runnable job)
addJob put a new job into the work queue
and notify the next available thread.
If all threads are busy the job remains in queue until one of the busy threads completes when it will check the work queue and process this job.
addJob in interface ThreadPuddlepublic State getState()
getState return the current snapshot
of the puddle state.
getState in interface ThreadPuddleState puddle status object.private int idleThreads()
private int firstIdleThread()
firstIdleThread - Called by the thread
pool to find the first idle thread.
int index of the next available
thread.public int findMe()
findMe called by a pool thread to find itself in the
vector of available threads.
public void idleMe()
idleMe mark the current thread as idle.
public java.lang.Runnable getJob()
getJob retrieve the next available job.
This is the job with the longest time in queue.
Runnable job from the tail of
the queue, null if job queue is empty.public void removeMe()
removeMe called by a pool thread to remove itself from
the vector of available threads
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||