public abstract class QueuePopulationThread<E> extends Thread
QueueWithSpare
. This thread will maintain a queue with
a maximum number of elements and will check to see if there need to be new elements
at a given interval. Generally this means that every request will receive a new element,
but should demand outstrip supply, the last element in the queue will be returned until
new elements can be created. This allows for generating expensive items (such
as key pairs) without creating a bottleneck in the system.
Created by Jeff Gaynor
on 2/20/12 at 11:03 AM
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Modifier | Constructor and Description |
---|---|
protected |
QueuePopulationThread(int maxQueueSize,
long sleepInterval,
QueueWithSpare<E> q) |
protected |
QueuePopulationThread(MyLoggingFacade logger) |
protected |
QueuePopulationThread(QueueWithSpare<E> q) |
Modifier and Type | Method and Description |
---|---|
protected abstract E |
createNew() |
protected MyLoggingFacade |
getLogger() |
QueueWithSpare<E> |
getQ() |
boolean |
isStopThread() |
protected void |
log(String x) |
void |
run() |
void |
setStopThread(boolean stopThread) |
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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected QueuePopulationThread(MyLoggingFacade logger)
protected QueuePopulationThread(QueueWithSpare<E> q)
protected QueuePopulationThread(int maxQueueSize, long sleepInterval, QueueWithSpare<E> q)
public QueueWithSpare<E> getQ()
protected MyLoggingFacade getLogger()
public boolean isStopThread()
public void setStopThread(boolean stopThread)
protected abstract E createNew()
protected void log(String x)
Copyright © 2019. All Rights Reserved.