Package cn.boboweike.carrot.server
Class BackgroundTaskServerConfiguration
- java.lang.Object
-
- cn.boboweike.carrot.server.BackgroundTaskServerConfiguration
-
public class BackgroundTaskServerConfiguration extends Object
This class allows to configure the BackgroundTaskServer
-
-
Field Summary
Fields Modifier and Type Field Description static DurationDEFAULT_DELETE_SUCCEEDED_TASKS_DURATIONstatic DurationDEFAULT_PERMANENTLY_DELETE_TASKS_DURATIONstatic intDEFAULT_POLL_INTERVAL_IN_SECONDS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BackgroundTaskServerConfigurationandBackgroundTaskServerWorkerPolicy(BackgroundTaskServerWorkerPolicy backgroundTaskServerWorkerPolicy)Allows to set the backgroundTaskServerWorkerPolicy for the BackgroundTaskServer.BackgroundTaskServerConfigurationandConcurrentTaskModificationPolicy(ConcurrentTaskModificationPolicy concurrentTaskModificationPolicy)Allows to set the ConcurrentTaskModificationPolicy for the BackgroundTaskServer.BackgroundTaskServerConfigurationandDeleteSucceededTasksAfter(Duration duration)Allows to set the duration to wait before deleting succeeded tasksBackgroundTaskServerConfigurationandPermanentlyDeleteDeletedTasksAfter(Duration duration)Allows to set the duration to wait before permanently deleting succeeded tasksBackgroundTaskServerConfigurationandPollIntervalInSeconds(int pollIntervalInSeconds)Allows to set the pollIntervalInSeconds for the BackgroundTaskServerBackgroundTaskServerConfigurationandWorkerCount(int workerCount)Allows to set the workerCount for the BackgroundTaskServer which defines the maximum number of tasks that will be run in parallelstatic BackgroundTaskServerConfigurationusingStandardBackgroundTaskServerConfiguration()This returns the default configuration with the BackgroundTaskServer with a poll interval of 15 seconds and a worker count based on the CPU
-
-
-
Field Detail
-
DEFAULT_POLL_INTERVAL_IN_SECONDS
public static final int DEFAULT_POLL_INTERVAL_IN_SECONDS
- See Also:
- Constant Field Values
-
DEFAULT_DELETE_SUCCEEDED_TASKS_DURATION
public static final Duration DEFAULT_DELETE_SUCCEEDED_TASKS_DURATION
-
DEFAULT_PERMANENTLY_DELETE_TASKS_DURATION
public static final Duration DEFAULT_PERMANENTLY_DELETE_TASKS_DURATION
-
-
Method Detail
-
usingStandardBackgroundTaskServerConfiguration
public static BackgroundTaskServerConfiguration usingStandardBackgroundTaskServerConfiguration()
This returns the default configuration with the BackgroundTaskServer with a poll interval of 15 seconds and a worker count based on the CPU- Returns:
- the default CarrotDashboard configuration
-
andPollIntervalInSeconds
public BackgroundTaskServerConfiguration andPollIntervalInSeconds(int pollIntervalInSeconds)
Allows to set the pollIntervalInSeconds for the BackgroundTaskServer- Parameters:
pollIntervalInSeconds- the pollIntervalInSeconds- Returns:
- the same configuration instance which provides a fluent api
-
andWorkerCount
public BackgroundTaskServerConfiguration andWorkerCount(int workerCount)
Allows to set the workerCount for the BackgroundTaskServer which defines the maximum number of tasks that will be run in parallel- Parameters:
workerCount- the workerCount for the BackgroundTaskServer- Returns:
- the same configuration instance which provides a fluent api
-
andBackgroundTaskServerWorkerPolicy
public BackgroundTaskServerConfiguration andBackgroundTaskServerWorkerPolicy(BackgroundTaskServerWorkerPolicy backgroundTaskServerWorkerPolicy)
Allows to set the backgroundTaskServerWorkerPolicy for the BackgroundTaskServer. The backgroundTaskServerWorkerPolicy will determine the final WorkDistributionStrategy used by the BackgroundTaskServer.- Parameters:
backgroundTaskServerWorkerPolicy- the backgroundTaskServerWorkerPolicy- Returns:
- the same configuration instance which provides a fluent api
-
andDeleteSucceededTasksAfter
public BackgroundTaskServerConfiguration andDeleteSucceededTasksAfter(Duration duration)
Allows to set the duration to wait before deleting succeeded tasks- Parameters:
duration- the duration to wait before deleting successful tasks- Returns:
- the same configuration instance which provides a fluent api
-
andPermanentlyDeleteDeletedTasksAfter
public BackgroundTaskServerConfiguration andPermanentlyDeleteDeletedTasksAfter(Duration duration)
Allows to set the duration to wait before permanently deleting succeeded tasks- Parameters:
duration- the duration to wait before permanently deleting successful tasks- Returns:
- the same configuration instance which provides a fluent api
-
andConcurrentTaskModificationPolicy
public BackgroundTaskServerConfiguration andConcurrentTaskModificationPolicy(ConcurrentTaskModificationPolicy concurrentTaskModificationPolicy)
Allows to set the ConcurrentTaskModificationPolicy for the BackgroundTaskServer. The ConcurrentTaskModificationPolicy will determine how the BackgroundTaskServer will react to concurrent modifications the tasks.Use with care.
- Parameters:
concurrentTaskModificationPolicy- the concurrentTaskModificationPolicy- Returns:
- the same configuration instance which provides a fluent api
-
-