Package org.apache.cassandra.concurrent
Interface ExecutorBuilder<E extends java.util.concurrent.ExecutorService>
-
- All Known Implementing Classes:
ThreadPoolExecutorBuilder
public interface ExecutorBuilder<E extends java.util.concurrent.ExecutorService>
Configure an executor before creating it. SeeThreadPoolExecutorBuilder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description E
build()
Build the configured executorExecutorBuilder<E>
withDefaultThreadGroup()
Use the system default thread group for the threads we create.ExecutorBuilder<E>
withKeepAlive()
Core threads for the executor built by this factory will never timeout (default for single threaded builders).ExecutorBuilder<E>
withKeepAlive(long keepAlive, java.util.concurrent.TimeUnit keepAliveUnits)
Threads for the executor built by this factory will timeout (terminate) after the specified period.ExecutorBuilder<E>
withQueueLimit(int queueLimit)
The executor built by this factory will limit the number of queued tasks; default is unlimited.ExecutorBuilder<E>
withRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Set theRejectedExecutionHandler
for the executor built by this factory.ExecutorBuilder<E>
withThreadGroup(java.lang.ThreadGroup threadGroup)
Threads for the executor built by this factory will all be (transitively) members ofthreadGroup
, but may directly reside in a child thread group.ExecutorBuilder<E>
withThreadPriority(int threadPriority)
Specify the priority of threads that service the executor built by this factory (default toThread.NORM_PRIORITY
)ExecutorBuilder<E>
withUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Set theThread.UncaughtExceptionHandler
for threads that service executors built by this factory.
-
-
-
Method Detail
-
withKeepAlive
ExecutorBuilder<E> withKeepAlive(long keepAlive, java.util.concurrent.TimeUnit keepAliveUnits)
Threads for the executor built by this factory will timeout (terminate) after the specified period.
-
withKeepAlive
ExecutorBuilder<E> withKeepAlive()
Core threads for the executor built by this factory will never timeout (default for single threaded builders). Note that there is ordinarily no difference between core and non-core threads; only when the queue limit is zero do we create non-core threads.
-
withThreadPriority
ExecutorBuilder<E> withThreadPriority(int threadPriority)
Specify the priority of threads that service the executor built by this factory (default toThread.NORM_PRIORITY
)
-
withThreadGroup
ExecutorBuilder<E> withThreadGroup(java.lang.ThreadGroup threadGroup)
Threads for the executor built by this factory will all be (transitively) members ofthreadGroup
, but may directly reside in a child thread group.
-
withDefaultThreadGroup
ExecutorBuilder<E> withDefaultThreadGroup()
Use the system default thread group for the threads we create. This is used only for testing, so that we do not hold onto a transitive global reference to all threads.
-
withQueueLimit
ExecutorBuilder<E> withQueueLimit(int queueLimit)
The executor built by this factory will limit the number of queued tasks; default is unlimited. Once the queue limit is reached and all threads are executing tasks will be rejected (seewithRejectedExecutionHandler(RejectedExecutionHandler)
)
-
withRejectedExecutionHandler
ExecutorBuilder<E> withRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Set theRejectedExecutionHandler
for the executor built by this factory. By default this is executor-specific, either:ThreadPoolExecutorBase.blockingExecutionHandler
ScheduledThreadPoolExecutorPlus.rejectedExecutionHandler
- and maybe wrapped by
ThreadPoolExecutorJMXAdapter.rejectedExecutionHandler(org.apache.cassandra.metrics.ThreadPoolMetrics, java.util.concurrent.RejectedExecutionHandler)
-
withUncaughtExceptionHandler
ExecutorBuilder<E> withUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Set theThread.UncaughtExceptionHandler
for threads that service executors built by this factory. By defaultJVMStabilityInspector.uncaughtException(Thread, Throwable)
-
build
E build()
Build the configured executor
-
-