Class BackgroundTaskServerConfiguration


  • public class BackgroundTaskServerConfiguration
    extends Object
    This class allows to configure the BackgroundTaskServer
    • 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