Class LimitedPipelineExecutor<O>
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- de.aristaflow.adept2.util.threading.AFThreadPoolExecutor
-
- de.aristaflow.adept2.util.threading.CachedThreadPoolExecutor
-
- de.aristaflow.adept2.util.threading.executor.AbstractObjectSpecificExecutor<O,P,Queue<Runnable>>
-
- de.aristaflow.adept2.util.threading.executor.AbstractPipeliningExecutor<O,Integer>
-
- de.aristaflow.adept2.util.threading.executor.LimitedPipelineExecutor<O>
-
- Type Parameters:
O
- The type of object for which work is registered and which identifies a pipeline.
- All Implemented Interfaces:
Executor
,ExecutorService
public class LimitedPipelineExecutor<O> extends AbstractPipeliningExecutor<O,Integer>
A pipeline executor that has an upper limit for the amount of pipelines. Several different objects will be executed by the same pipeline.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description protected int
limit
The maximum amount of pipelines.-
Fields inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectSpecificExecutor
abortCount, flushPending, logger, objects, shutdownPending
-
Fields inherited from class de.aristaflow.adept2.util.threading.CachedThreadPoolExecutor
fullSize, realCoreSize, realMaxSize, workSize
-
Fields inherited from class de.aristaflow.adept2.util.threading.AFThreadPoolExecutor
activeThreads, completedTasks, HYSTERESIS, submittedTasks
-
-
Constructor Summary
Constructors Constructor Description LimitedPipelineExecutor(int limit, Adept2ThreadFactory threadFactory)
Creates a new thread pool executor with the designated amount of pipelines and threads.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Integer
getIndexObjectFor(O object)
Gets the object used for managing and executing runnables within this executor.-
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractPipeliningExecutor
addRunnable, cancelAndFlush, clearAbortedPendingWork, createPipelineRunnable, executeShutdown, getOutstandingRunnables
-
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectSpecificExecutor
execute, flushAndExecute, flushAndExecuteUnchecked, isShutdown, restart, restartPendingWork, shutdown, shutdownNow, shutdownRunnableRun, submit, submit, submitAndFlush
-
Methods inherited from class de.aristaflow.adept2.util.threading.CachedThreadPoolExecutor
afterExecute, execute
-
Methods inherited from class de.aristaflow.adept2.util.threading.AFThreadPoolExecutor
beforeExecute, logPoolStatistics, newTaskFor, newTaskFor, recalculateLogLimits, setCorePoolSize, setLogExecuteCallStack, setMaximumPoolSize, updateQueueLimit
-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setKeepAliveTime, setRejectedExecutionHandler, setThreadFactory, terminated, toString
-
-
-
-
Constructor Detail
-
LimitedPipelineExecutor
public LimitedPipelineExecutor(int limit, Adept2ThreadFactory threadFactory)
Creates a new thread pool executor with the designated amount of pipelines and threads. The threads will stay idle for 60 seconds before they terminate.- Parameters:
limit
- The maximum number of threads allowed in the pool and also the maximum number of pipelines.threadFactory
- The factory to use when the executor creates a new thread.
-
-
Method Detail
-
getIndexObjectFor
protected Integer getIndexObjectFor(O object)
Gets the object used for managing and executing runnables within this executor. Returns the hashcode of the designated object modulo the limit.- Specified by:
getIndexObjectFor
in classAbstractObjectSpecificExecutor<O,Integer,Queue<Runnable>>
- Parameters:
object
- The object for which a runnable is registered.- Returns:
- The object used for managing and executing runnables (registered for the designated object) within this executor.
-
-