Package org.apache.cassandra.concurrent
Class ExecutorFactory.Default
java.lang.Object
org.apache.cassandra.concurrent.NamedThreadFactory.MetaFactory
org.apache.cassandra.concurrent.ExecutorFactory.Default
- All Implemented Interfaces:
ExecutorBuilderFactory<ExecutorPlus,,SequentialExecutorPlus> ExecutorBuilderFactory.Jmxable<ExecutorPlus,,SequentialExecutorPlus> ExecutorFactory
- Enclosing interface:
- ExecutorFactory
public static final class ExecutorFactory.Default
extends NamedThreadFactory.MetaFactory
implements ExecutorFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory
ExecutorBuilderFactory.Jmxable<E extends ExecutorPlus,S extends SequentialExecutorPlus> Nested classes/interfaces inherited from interface org.apache.cassandra.concurrent.ExecutorFactory
ExecutorFactory.Default, ExecutorFactory.Global, ExecutorFactory.LocalAwareSubFactory, ExecutorFactory.LocalAwareSubFactoryWithJMX, ExecutorFactory.SimulatorSemantics -
Field Summary
Fields inherited from class org.apache.cassandra.concurrent.NamedThreadFactory.MetaFactory
contextClassLoader, threadGroup, uncaughtExceptionHandler -
Constructor Summary
ConstructorsConstructorDescriptionDefault(ClassLoader contextClassLoader, ThreadGroup threadGroup, Thread.UncaughtExceptionHandler uncaughtExceptionHandler) -
Method Summary
Modifier and TypeMethodDescriptionconfigurePooled(String name, int threads) Configure a pooled executor with the requested number of threadsconfigureSequential(String name) Configure a sequential (single threaded) executorinfiniteLoop(String name, Interruptible.Task task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe, InfiniteLoopExecutor.Daemon daemon, InfiniteLoopExecutor.Interrupts interrupts) Create and start a new InfiniteLoopExecutor to repeatedly invokerunnable.newThreadGroup(String name) Create a new thread group for use with builders - this thread group will be situated within this factory's parent thread group, and may be supplied to multiple executor builders.scheduled(boolean executeOnShutdown, String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics) startThread(String name, Runnable runnable, InfiniteLoopExecutor.Daemon daemon) Create and start a new thread to executerunnableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory
pooled, sequentialMethods inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory.Jmxable
withJmxInternalMethods inherited from interface org.apache.cassandra.concurrent.ExecutorFactory
infiniteLoop, scheduled, scheduled, scheduled, scheduled, startThread
-
Constructor Details
-
Default
public Default(ClassLoader contextClassLoader, ThreadGroup threadGroup, Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
-
-
Method Details
-
localAware
- Specified by:
localAwarein interfaceExecutorFactory- Returns:
- a factory that configures executors that propagate
ExecutorLocalsto the executing thread
-
withJmx
- Specified by:
withJmxin interfaceExecutorBuilderFactory.Jmxable<ExecutorPlus,SequentialExecutorPlus> - Returns:
- a factory that configures executors that register against JMX using the provided jmx path
-
configureSequential
Description copied from interface:ExecutorBuilderFactoryConfigure a sequential (single threaded) executor- Specified by:
configureSequentialin interfaceExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus>
-
configurePooled
Description copied from interface:ExecutorBuilderFactoryConfigure a pooled executor with the requested number of threads- Specified by:
configurePooledin interfaceExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus>
-
scheduled
public ScheduledExecutorPlus scheduled(boolean executeOnShutdown, String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics) - Specified by:
scheduledin interfaceExecutorFactory- Parameters:
executeOnShutdown- if false, waiting tasks will be cancelled on shutdownname- the name of the executor, the executor's thread group, and of any worker threadspriority- the thread priority of workerssimulatorSemantics- indicate special semantics for the executor under simulation- Returns:
- a
ScheduledExecutorPlus
-
startThread
Description copied from interface:ExecutorFactoryCreate and start a new thread to executerunnable- Specified by:
startThreadin interfaceExecutorFactory- Parameters:
name- the name of the threadrunnable- the task to executedaemon- flag to indicate whether the thread should be a daemon or not- Returns:
- the new thread
-
infiniteLoop
public Interruptible infiniteLoop(String name, Interruptible.Task task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe, InfiniteLoopExecutor.Daemon daemon, InfiniteLoopExecutor.Interrupts interrupts) Description copied from interface:ExecutorFactoryCreate and start a new InfiniteLoopExecutor to repeatedly invokerunnable. On shutdown, the executing thread will be interrupted; to support clean shutdownrunnableshould propagateInterruptedException- Specified by:
infiniteLoopin interfaceExecutorFactory- Parameters:
name- the name of the thread used to invoke the task repeatedlytask- the task to execute repeatedlysimulatorSafe- flag indicating if the loop thread can be intercepted / rescheduled during cluster simulationdaemon- flag to indicate whether the loop thread should be a daemon thread or notinterrupts- flag to indicate whether to synchronize interrupts of the task execution thread using the task's monitor this can be used to prevent interruption while performing IO operations which forbid interrupted threads. See:AbstractCommitLogSegmentManager.start()- Returns:
- the new thread
-
newThreadGroup
Description copied from interface:ExecutorFactoryCreate a new thread group for use with builders - this thread group will be situated within this factory's parent thread group, and may be supplied to multiple executor builders.- Specified by:
newThreadGroupin interfaceExecutorFactory
-