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
Constructors Constructor Description Default(java.lang.ClassLoader contextClassLoader, java.lang.ThreadGroup threadGroup, java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutorBuilder<ThreadPoolExecutorPlus>configurePooled(java.lang.String name, int threads)Configure a pooled executor with the requested number of threadsExecutorBuilder<SingleThreadExecutorPlus>configureSequential(java.lang.String name)Configure a sequential (single threaded) executorInterruptibleinfiniteLoop(java.lang.String name, Interruptible.Task task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe, InfiniteLoopExecutor.Daemon daemon, InfiniteLoopExecutor.Interrupts interrupts)Create and start a new InfiniteLoopExecutor to repeatedly invokerunnable.ExecutorFactory.LocalAwareSubFactorylocalAware()java.lang.ThreadGroupnewThreadGroup(java.lang.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.ScheduledExecutorPlusscheduled(boolean executeOnShutdown, java.lang.String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics)java.lang.ThreadstartThread(java.lang.String name, java.lang.Runnable runnable, InfiniteLoopExecutor.Daemon daemon)Create and start a new thread to executerunnableExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus>withJmx(java.lang.String jmxPath)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory
pooled, sequential
-
Methods inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory.Jmxable
withJmxInternal
-
Methods inherited from interface org.apache.cassandra.concurrent.ExecutorFactory
infiniteLoop, scheduled, scheduled, scheduled, scheduled, startThread
-
-
-
-
Method Detail
-
localAware
public ExecutorFactory.LocalAwareSubFactory localAware()
- Specified by:
localAwarein interfaceExecutorFactory- Returns:
- a factory that configures executors that propagate
ExecutorLocalsto the executing thread
-
withJmx
public ExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus> withJmx(java.lang.String jmxPath)
- Specified by:
withJmxin interfaceExecutorBuilderFactory.Jmxable<ExecutorPlus,SequentialExecutorPlus>- Returns:
- a factory that configures executors that register against JMX using the provided jmx path
-
configureSequential
public ExecutorBuilder<SingleThreadExecutorPlus> configureSequential(java.lang.String name)
Description copied from interface:ExecutorBuilderFactoryConfigure a sequential (single threaded) executor- Specified by:
configureSequentialin interfaceExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus>
-
configurePooled
public ExecutorBuilder<ThreadPoolExecutorPlus> configurePooled(java.lang.String name, int threads)
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, java.lang.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
public java.lang.Thread startThread(java.lang.String name, java.lang.Runnable runnable, InfiniteLoopExecutor.Daemon daemon)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(java.lang.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
public java.lang.ThreadGroup newThreadGroup(java.lang.String name)
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
-
-