Package edu.uiuc.ncsa.security.core.util
Class QueuePopulationThread<E>
- java.lang.Object
-
- java.lang.Thread
-
- edu.uiuc.ncsa.security.core.util.QueuePopulationThread<E>
-
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
KeyPairPopulationThread
public abstract class QueuePopulationThread<E> extends Thread
A thread for populating aQueueWithSpare
. 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
QueuePopulationThread(int maxQueueSize, long sleepInterval, QueueWithSpare<E> q)
protected
QueuePopulationThread(MyLoggingFacade logger)
protected
QueuePopulationThread(QueueWithSpare<E> q)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract E
createNew()
protected MyLoggingFacade
getLogger()
QueueWithSpare<E>
getQ()
boolean
isStopThread()
protected void
log(String x)
void
run()
void
setStopThread(boolean stopThread)
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
QueuePopulationThread
protected QueuePopulationThread(MyLoggingFacade logger)
-
QueuePopulationThread
protected QueuePopulationThread(QueueWithSpare<E> q)
-
QueuePopulationThread
protected QueuePopulationThread(int maxQueueSize, long sleepInterval, QueueWithSpare<E> q)
-
-
Method Detail
-
getQ
public QueueWithSpare<E> getQ()
-
getLogger
protected MyLoggingFacade getLogger()
-
isStopThread
public boolean isStopThread()
-
setStopThread
public void setStopThread(boolean stopThread)
-
createNew
protected abstract E createNew()
-
log
protected void log(String x)
-
-