public abstract static class GlobalOrchestratorConfig.Config extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ExecutorService |
executorService |
protected List<TaskRunner> |
first |
protected List<BiConsumer<Orchestrator,Object>> |
initializers |
protected List<TaskRunner> |
last |
protected SpawnMode |
spawnMode |
protected long |
timeoutMs |
protected TimeoutStrategy |
timeoutStrategy |
| Modifier | Constructor and Description |
|---|---|
protected |
Config() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
afterDefaultInitialization(Orchestrator orchestrator,
Object arg)
Subclasses can override to provide custom logic for
updateConfigurationOn(Orchestrator, Object). |
void |
firstInterceptWith(TaskRunner runner)
Adds a TaskRunner that will be processed before any existing TaskRunner.
|
ExecutorService |
getExecutorService() |
int |
getNumberOfInterceptors()
Returns the current number of interceptors, as set by
CommonConfig.firstInterceptWith(TaskRunner),
CommonConfig.lastInterceptWith(TaskRunner), or for Orchestrators as set from current global settings. |
SpawnMode |
getSpawnMode()
Gets the most recently set mode.
|
long |
getTimeoutMs()
Gets the current timeout.
|
TimeoutStrategy |
getTimeoutStrategy()
Gets the current timeout strategy, default is
TimeoutStrategy.PREVENT_NEW. |
void |
initializeWith(BiConsumer<Orchestrator,Object> fn) |
void |
lastInterceptWith(TaskRunner runner)
Adds a TaskRunner that will be processed after any existing TaskRunner.
|
void |
removeAllTaskRunners()
Removes all interceptors from the current list.
|
void |
removeInterceptor(TaskRunner taskRunner)
Removes the given TaskRunner from the current list, if it is there.
|
void |
restoreConfigurationDefaults(Object arg)
Restore default settings.
|
void |
restoreDefaultExecutorService() |
void |
setExecutorService(ExecutorService executorService)
Resets the service used by this framework for spawning threads.
|
void |
setSpawnMode(SpawnMode mode)
Changes the thread-spawning logic to be consistent with the specified mode.
|
void |
setTimeoutMs(long ms)
Sets the current timeout.
|
void |
setTimeoutStrategy(TimeoutStrategy strategy)
Sets the strategy to apply if a timeout greater than zero is in effect and is exceeded.
|
void |
updateConfigurationOn(Orchestrator orchestrator,
Object arg)
Transfers configuration settings to the supplied orchestrator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetTimeoutprotected ExecutorService executorService
protected final List<TaskRunner> first
protected final List<TaskRunner> last
protected SpawnMode spawnMode
protected long timeoutMs
protected TimeoutStrategy timeoutStrategy
protected final List<BiConsumer<Orchestrator,Object>> initializers
public final void updateConfigurationOn(Orchestrator orchestrator, Object arg)
orchestrator - to updatearg - passed from user code, see afterDefaultInitialization(Orchestrator, Object)public abstract void afterDefaultInitialization(Orchestrator orchestrator, Object arg)
updateConfigurationOn(Orchestrator, Object).
The arg parameter is what is passed to Orchestrator.create(String, Object), without modification.
It is intended to allow for this method to know to apply different settings for different orchestrators,
if desired.orchestrator - to updatearg - passed from user codepublic final void restoreConfigurationDefaults(Object arg)
CommonConfigpublic SpawnMode getSpawnMode()
CommonConfigSpawnMode.WHEN_NEEDED. The Orchestrator
default is null, which results in using the global setting.public void setSpawnMode(SpawnMode mode)
CommonConfigmode - to setpublic long getTimeoutMs()
CommonConfigpublic void setTimeoutMs(long ms)
CommonConfigCommonConfig.getTimeoutStrategy() will apply.ms - duration in milliseconds, zero means no timeout will be appliedpublic TimeoutStrategy getTimeoutStrategy()
CommonConfigTimeoutStrategy.PREVENT_NEW.CommonConfig.setTimeoutStrategy(TimeoutStrategy)public void setTimeoutStrategy(TimeoutStrategy strategy)
CommonConfigstrategy - to setpublic ExecutorService getExecutorService()
public void setExecutorService(ExecutorService executorService)
CommonConfigGlobalOrchestratorConfig.DEFAULT_FIXED_THREADPOOL_SIZE.executorService - to set as new defaultpublic void restoreDefaultExecutorService()
public void firstInterceptWith(TaskRunner runner)
CommonConfigrunner - to addpublic void lastInterceptWith(TaskRunner runner)
CommonConfigrunner - to addpublic int getNumberOfInterceptors()
CommonConfigCommonConfig.firstInterceptWith(TaskRunner),
CommonConfig.lastInterceptWith(TaskRunner), or for Orchestrators as set from current global settings.public void removeInterceptor(TaskRunner taskRunner)
CommonConfigtaskRunner - to removepublic void removeAllTaskRunners()
CommonConfigpublic void initializeWith(BiConsumer<Orchestrator,Object> fn)
Copyright © 2021. All rights reserved.