Package org.hawaiiframework.async.model
Class ExecutorConfigurationProperties
java.lang.Object
org.hawaiiframework.async.model.ExecutorConfigurationProperties
Configuration properties for the asynchronous execution. The properties consist of two parts:
- Executors
- Systems, containing Calls
From each of the executor configurations, a ThreadPoolTaskExecutor will be created. The default
executor is the fallback for any task not specifically configured to an executor.
A system is a group of tasks, assumed to belong to a single system, for example a backend system. Both a system and a call can be assigned to an executor, where the task configuration takes precedence.
Note that any task not specifically assigned to an executor will default to the global default executor.
- Since:
- 2.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExecutor(ExecutorProperties executor) Convenience method to add properties for a single executor.voidaddSystem(SystemProperties system) Convenience method to add properties for a single system.Getter for the async task timeout executor pool size.Getter for the default executor.Getter for default timeout.Getter for the executors.getSystemPropertiesForName(String systemName) Retrieve the properties for the system with the given name.Getter for the systems.getTaskTimeout(String taskName) Determine the timeout for a task.voidsetAsyncTimeoutExecutorPoolSize(Integer asyncTimeoutExecutorPoolSize) Setter for the async task timeout executor pool size.voidsetDefaultExecutor(String defaultExecutor) Setter for the default executor.voidsetDefaultTimeout(Integer defaultTimeout) Setter for the default timeout.voidsetExecutors(List<ExecutorProperties> executors) Setter for the executors.voidsetSystems(List<SystemProperties> systems) Setter for the systems.
-
Constructor Details
-
ExecutorConfigurationProperties
public ExecutorConfigurationProperties()
-
-
Method Details
-
getDefaultExecutor
Getter for the default executor.- Returns:
- the default executor
-
setDefaultExecutor
Setter for the default executor.- Parameters:
defaultExecutor- the default executor
-
getDefaultTimeout
Getter for default timeout.- Returns:
- the default timeout
-
setDefaultTimeout
Setter for the default timeout.- Parameters:
defaultTimeout- the default timeout
-
getAsyncTimeoutExecutorPoolSize
Getter for the async task timeout executor pool size.- Returns:
- the core pool size to use.
-
setAsyncTimeoutExecutorPoolSize
Setter for the async task timeout executor pool size.- Parameters:
asyncTimeoutExecutorPoolSize- the core pool size to set.
-
getExecutors
Getter for the executors.- Returns:
- the executors
-
setExecutors
Setter for the executors.- Parameters:
executors- the executors
-
addExecutor
Convenience method to add properties for a single executor.- Parameters:
executor- the executor properties
-
getSystems
Getter for the systems.- Returns:
- the systems
-
setSystems
Setter for the systems.- Parameters:
systems- the systems
-
addSystem
Convenience method to add properties for a single system.- Parameters:
system- the system properties
-
getTaskTimeout
Determine the timeout for a task.The task name must be formatted as
{system}.{task}. If a specific timeout is configured for the task, it is returned. Otherwise, the system's default timeout or the general default timeout is returned as a fallback value.- Parameters:
taskName- the task name- Returns:
- the timeout, or null if the task or system doesn't exist
-
getSystemPropertiesForName
Retrieve the properties for the system with the given name.- Parameters:
systemName- the system name- Returns:
- the properties
-