Package org.citydb.concurrent
Class WorkerPool<T>
- java.lang.Object
-
- org.citydb.concurrent.WorkerPool<T>
-
- Direct Known Subclasses:
SingleWorkerPool
public class WorkerPool<T> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WorkerPool.WorkQueue<E>
-
Constructor Summary
Constructors Constructor Description WorkerPool(java.lang.String poolName, int corePoolSize, int maximumPoolSize, PoolSizeAdaptationStrategy adaptationStrategy, WorkerFactory<T> workerFactory, int queueSize)
WorkerPool(java.lang.String poolName, int corePoolSize, int maximumPoolSize, PoolSizeAdaptationStrategy adaptationStrategy, WorkerFactory<T> workerFactory, int queueSize, boolean fair)
WorkerPool(java.lang.String poolName, int corePoolSize, int maximumPoolSize, PoolSizeAdaptationStrategy adaptationStrategy, WorkerFactory<T> workerFactory, int queueSize, boolean fair, boolean daemon)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWork(T work)
void
addWorkAndWait(T work)
void
awaitQueueEmpty()
java.util.List<T>
drainWorkQueue()
int
getCorePoolSize()
java.lang.ClassLoader
getDefaultContextClassLoader()
int
getMaximumPoolSize()
int
getMaximumQueueSize()
java.lang.String
getName()
int
getPoolSize()
PoolSizeAdaptationStrategy
getPoolSizeAdaptationStrategy()
WorkerFactory<T>
getWorkerFactory()
WorkerPool.WorkQueue<T>
getWorkQueue()
boolean
isTerminated()
boolean
isTerminating()
void
join()
boolean
prestartCoreWorker()
int
prestartCoreWorkers()
void
setContextClassLoader(java.lang.ClassLoader contextClassLoader)
void
setCorePoolSize(int corePoolSize)
void
setEventSource(java.lang.Object eventSource)
void
setMaximumPoolSize(int maximumPoolSize)
void
setPoolSizeAdaptationStrategy(PoolSizeAdaptationStrategy adaptationStrategy)
void
shutdown()
void
shutdownAndWait()
java.util.List<T>
shutdownNow()
-
-
-
Constructor Detail
-
WorkerPool
public WorkerPool(java.lang.String poolName, int corePoolSize, int maximumPoolSize, PoolSizeAdaptationStrategy adaptationStrategy, WorkerFactory<T> workerFactory, int queueSize, boolean fair, boolean daemon)
-
WorkerPool
public WorkerPool(java.lang.String poolName, int corePoolSize, int maximumPoolSize, PoolSizeAdaptationStrategy adaptationStrategy, WorkerFactory<T> workerFactory, int queueSize, boolean fair)
-
WorkerPool
public WorkerPool(java.lang.String poolName, int corePoolSize, int maximumPoolSize, PoolSizeAdaptationStrategy adaptationStrategy, WorkerFactory<T> workerFactory, int queueSize)
-
-
Method Detail
-
getDefaultContextClassLoader
public java.lang.ClassLoader getDefaultContextClassLoader()
-
setContextClassLoader
public void setContextClassLoader(java.lang.ClassLoader contextClassLoader)
-
setEventSource
public void setEventSource(java.lang.Object eventSource)
-
addWork
public void addWork(T work)
-
addWorkAndWait
public void addWorkAndWait(T work)
-
prestartCoreWorker
public boolean prestartCoreWorker()
-
prestartCoreWorkers
public int prestartCoreWorkers()
-
shutdown
public void shutdown()
-
shutdownAndWait
public void shutdownAndWait() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
shutdownNow
public java.util.List<T> shutdownNow()
-
join
public void join() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
awaitQueueEmpty
public void awaitQueueEmpty()
-
drainWorkQueue
public java.util.List<T> drainWorkQueue()
-
getWorkQueue
public WorkerPool.WorkQueue<T> getWorkQueue()
-
getWorkerFactory
public WorkerFactory<T> getWorkerFactory()
-
getMaximumQueueSize
public int getMaximumQueueSize()
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
-
getMaximumPoolSize
public int getMaximumPoolSize()
-
getCorePoolSize
public int getCorePoolSize()
-
isTerminated
public boolean isTerminated()
-
isTerminating
public boolean isTerminating()
-
getPoolSize
public int getPoolSize()
-
getPoolSizeAdaptationStrategy
public PoolSizeAdaptationStrategy getPoolSizeAdaptationStrategy()
-
setPoolSizeAdaptationStrategy
public void setPoolSizeAdaptationStrategy(PoolSizeAdaptationStrategy adaptationStrategy)
-
getName
public java.lang.String getName()
-
-