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) executorInterruptible
infiniteLoop(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.LocalAwareSubFactory
localAware()
java.lang.ThreadGroup
newThreadGroup(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.ScheduledExecutorPlus
scheduled(boolean executeOnShutdown, java.lang.String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics)
java.lang.Thread
startThread(java.lang.String name, java.lang.Runnable runnable, InfiniteLoopExecutor.Daemon daemon)
Create and start a new thread to executerunnable
ExecutorBuilderFactory<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:
localAware
in interfaceExecutorFactory
- Returns:
- a factory that configures executors that propagate
ExecutorLocals
to the executing thread
-
withJmx
public ExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus> withJmx(java.lang.String jmxPath)
- Specified by:
withJmx
in 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:ExecutorBuilderFactory
Configure a sequential (single threaded) executor- Specified by:
configureSequential
in interfaceExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus>
-
configurePooled
public ExecutorBuilder<ThreadPoolExecutorPlus> configurePooled(java.lang.String name, int threads)
Description copied from interface:ExecutorBuilderFactory
Configure a pooled executor with the requested number of threads- Specified by:
configurePooled
in interfaceExecutorBuilderFactory<ExecutorPlus,SequentialExecutorPlus>
-
scheduled
public ScheduledExecutorPlus scheduled(boolean executeOnShutdown, java.lang.String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics)
- Specified by:
scheduled
in 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:ExecutorFactory
Create and start a new thread to executerunnable
- Specified by:
startThread
in 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:ExecutorFactory
Create and start a new InfiniteLoopExecutor to repeatedly invokerunnable
. On shutdown, the executing thread will be interrupted; to support clean shutdownrunnable
should propagateInterruptedException
- Specified by:
infiniteLoop
in 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:ExecutorFactory
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.- Specified by:
newThreadGroup
in interfaceExecutorFactory
-
-