|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--com.debianmirror.server.WorkerCache
The WorkerCache hold a bunch of already started Worker threads. This way the delay of creating a new thread is minimized. It also controls how many Worker threads are running concurrently.
| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
WorkerCache(WorkerImplFactory factory)
Creates a new WorkerCache. |
|
| Method Summary | |
void |
addWorker(Worker worker)
Inserts the given Worker (back) into this WorkerCache. |
Worker |
getWorker()
Returns an idle worker from the workerList. |
void |
killCache()
Kills the cache gracefully. |
void |
run()
Main method of the thread. |
void |
setMaxIdleWorkers(int mIW)
Sets the maxIdleWorkers. |
void |
setMinIdleWorkers(int mIW)
Sets the minIdleWorkers. |
| 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 |
| Constructor Detail |
public WorkerCache(WorkerImplFactory factory)
factory - | Method Detail |
public void setMinIdleWorkers(int mIW)
minIdleWorkers.
mIW - the desired numbers of minimal idleWorkers.public void setMaxIdleWorkers(int mIW)
maxIdleWorkers.
public Worker getWorker()
Returns an idle worker from the workerList.
public void addWorker(Worker worker)
Inserts the given Worker (back) into this WorkerCache.
That is if the WorkerCache is not full yet.
Mostly used by the Worker after it is
done with the assigned work.
public void killCache()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||