public interface ExecutorFactory extends ExecutorBuilderFactory.Jmxable<ExecutorPlus,SequentialExecutorPlus>
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)
Modifier and Type | Interface and Description |
---|---|
static class |
ExecutorFactory.Default |
static class |
ExecutorFactory.Global |
static interface |
ExecutorFactory.LocalAwareSubFactory |
static interface |
ExecutorFactory.LocalAwareSubFactoryWithJMX |
static class |
ExecutorFactory.SimulatorSemantics |
ExecutorBuilderFactory.Jmxable<E extends ExecutorPlus,S extends SequentialExecutorPlus>
Modifier and Type | Method and Description |
---|---|
default Interruptible |
infiniteLoop(java.lang.String name,
Interruptible.SimpleTask task,
InfiniteLoopExecutor.SimulatorSafe simulatorSafe)
Create and start a new InfiniteLoopExecutor to repeatedly invoke
runnable . |
Interruptible |
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 invoke
runnable . |
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.
|
default ScheduledExecutorPlus |
scheduled(boolean executeOnShutdown,
java.lang.String name) |
default ScheduledExecutorPlus |
scheduled(boolean executeOnShutdown,
java.lang.String name,
int priority) |
ScheduledExecutorPlus |
scheduled(boolean executeOnShutdown,
java.lang.String name,
int priority,
ExecutorFactory.SimulatorSemantics simulatorSemantics) |
default ScheduledExecutorPlus |
scheduled(java.lang.String name) |
default ScheduledExecutorPlus |
scheduled(java.lang.String name,
ExecutorFactory.SimulatorSemantics simulatorSemantics) |
default java.lang.Thread |
startThread(java.lang.String name,
java.lang.Runnable runnable)
Create and start a new thread to execute
runnable ; this thread will be a daemon thread. |
java.lang.Thread |
startThread(java.lang.String name,
java.lang.Runnable runnable,
InfiniteLoopExecutor.Daemon daemon)
Create and start a new thread to execute
runnable |
withJmx, withJmxInternal
configurePooled, configureSequential, pooled, sequential
ExecutorFactory.LocalAwareSubFactory localAware()
ExecutorLocals
to the executing threaddefault ScheduledExecutorPlus scheduled(java.lang.String name)
name
- the name of the executor, the executor's thread group, and of any worker threadsScheduledExecutorPlus
default ScheduledExecutorPlus scheduled(java.lang.String name, ExecutorFactory.SimulatorSemantics simulatorSemantics)
name
- the name of the executor, the executor's thread group, and of any worker threadssimulatorSemantics
- indicate special semantics for the executor under simulationScheduledExecutorPlus
default ScheduledExecutorPlus scheduled(boolean executeOnShutdown, java.lang.String name)
executeOnShutdown
- if false, waiting tasks will be cancelled on shutdownname
- the name of the executor, the executor's thread group, and of any worker threadsScheduledExecutorPlus
with normal thread prioritydefault ScheduledExecutorPlus scheduled(boolean executeOnShutdown, java.lang.String name, int priority)
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 workersScheduledExecutorPlus
ScheduledExecutorPlus scheduled(boolean executeOnShutdown, java.lang.String name, int priority, ExecutorFactory.SimulatorSemantics simulatorSemantics)
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 simulationScheduledExecutorPlus
java.lang.Thread startThread(java.lang.String name, java.lang.Runnable runnable, InfiniteLoopExecutor.Daemon daemon)
runnable
name
- the name of the threadrunnable
- the task to executedaemon
- flag to indicate whether the thread should be a daemon or notdefault java.lang.Thread startThread(java.lang.String name, java.lang.Runnable runnable)
runnable
; this thread will be a daemon thread.name
- the name of the threadrunnable
- the task to executeInterruptible infiniteLoop(java.lang.String name, Interruptible.Task task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe, InfiniteLoopExecutor.Daemon daemon, InfiniteLoopExecutor.Interrupts interrupts)
runnable
.
On shutdown, the executing thread will be interrupted; to support clean shutdown
runnable
should propagate InterruptedException
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: org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager::start
default Interruptible infiniteLoop(java.lang.String name, Interruptible.SimpleTask task, InfiniteLoopExecutor.SimulatorSafe simulatorSafe)
runnable
.
On shutdown, the executing thread will be interrupted; to support clean shutdown
runnable
should propagate InterruptedException
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 simulationjava.lang.ThreadGroup newThreadGroup(java.lang.String name)
Copyright © 2009-2022 The Apache Software Foundation