Package org.apache.cassandra.concurrent
Interface ExecutorFactory
- All Superinterfaces:
ExecutorBuilderFactory<ExecutorPlus,,SequentialExecutorPlus> ExecutorBuilderFactory.Jmxable<ExecutorPlus,SequentialExecutorPlus>
- All Known Implementing Classes:
ExecutorFactory.Default
public interface ExecutorFactory
extends ExecutorBuilderFactory.Jmxable<ExecutorPlus,SequentialExecutorPlus>
Entry point for configuring and creating new executors.
Supports quick and easy construction of default-configured executors via
ExecutorBuilderFactory.sequential(String)
ExecutorBuilderFactory.pooled(String, int)
scheduled(String)
scheduled(boolean, String)
scheduled(boolean, String, int)
Supports custom configuration of executors via
ExecutorBuilderFactory.configureSequential(String)
ExecutorBuilderFactory.configurePooled(String, int)
Supports any of the above with added JMX registration via sub-factories
ExecutorBuilderFactory.Jmxable.withJmx(String)
ExecutorBuilderFactory.Jmxable.withJmxInternal()
Supports any of the above with the resultant executor propagating ExecutorLocals via sub-factory
localAware()
Supports shared executors via sub-factory localAware().withJMX()
using ExecutorFactory.LocalAwareSubFactoryWithJMX.shared(String, int, ExecutorPlus.MaximumPoolSizeListener)-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final classstatic interfacestatic interfacestatic enumNested classes/interfaces inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory
ExecutorBuilderFactory.Jmxable<E extends ExecutorPlus,S extends SequentialExecutorPlus> -
Method Summary
Modifier and TypeMethodDescriptiondefault InterruptibleinfiniteLoop(String name, Interruptible.SimpleTask task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe) Create and start a new InfiniteLoopExecutor to repeatedly invokerunnable.infiniteLoop(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.default ScheduledExecutorPlusdefault ScheduledExecutorPlusscheduled(boolean executeOnShutdown, String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics) default ScheduledExecutorPlusdefault ScheduledExecutorPlusscheduled(String name, ExecutorFactory.SimulatorSemantics simulatorSemantics) default ThreadstartThread(String name, Runnable runnable) Create and start a new thread to executerunnable; this thread will be a daemon thread.startThread(String name, Runnable runnable, InfiniteLoopExecutor.Daemon daemon) Create and start a new thread to executerunnableMethods inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory
configurePooled, configureSequential, pooled, sequentialMethods inherited from interface org.apache.cassandra.concurrent.ExecutorBuilderFactory.Jmxable
withJmx, withJmxInternal
-
Method Details
-
localAware
ExecutorFactory.LocalAwareSubFactory localAware()- Returns:
- a factory that configures executors that propagate
ExecutorLocalsto the executing thread
-
scheduled
- Parameters:
name- the name of the executor, the executor's thread group, and of any worker threads- Returns:
- a default-configured
ScheduledExecutorPlus
-
scheduled
default ScheduledExecutorPlus scheduled(String name, ExecutorFactory.SimulatorSemantics simulatorSemantics) - Parameters:
name- the name of the executor, the executor's thread group, and of any worker threadssimulatorSemantics- indicate special semantics for the executor under simulation- Returns:
- a default-configured
ScheduledExecutorPlus
-
scheduled
- 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 threads- Returns:
- a
ScheduledExecutorPluswith normal thread priority
-
scheduled
- 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 workers- Returns:
- a
ScheduledExecutorPlus
-
scheduled
ScheduledExecutorPlus scheduled(boolean executeOnShutdown, String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics) - 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
Create and start a new thread to executerunnable- 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
-
startThread
Create and start a new thread to executerunnable; this thread will be a daemon thread.- Parameters:
name- the name of the threadrunnable- the task to execute- Returns:
- the new thread
-
infiniteLoop
Interruptible infiniteLoop(String name, Interruptible.Task task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe, InfiniteLoopExecutor.Daemon daemon, InfiniteLoopExecutor.Interrupts interrupts) Create and start a new InfiniteLoopExecutor to repeatedly invokerunnable. On shutdown, the executing thread will be interrupted; to support clean shutdownrunnableshould propagateInterruptedException- 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
-
infiniteLoop
default Interruptible infiniteLoop(String name, Interruptible.SimpleTask task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe) Create and start a new InfiniteLoopExecutor to repeatedly invokerunnable. On shutdown, the executing thread will be interrupted; to support clean shutdownrunnableshould propagateInterruptedException- 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 simulation- Returns:
- the new thread
-
newThreadGroup
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.
-