Class ConfigurationScheduler

    • Field Detail

      • LOGGER

        private static final Logger LOGGER
      • SIMPLE_NAME

        private static final java.lang.String SIMPLE_NAME
      • executorService

        private volatile java.util.concurrent.ScheduledExecutorService executorService
      • scheduledItems

        private int scheduledItems
      • name

        private final java.lang.String name
    • Constructor Detail

      • ConfigurationScheduler

        public ConfigurationScheduler()
      • ConfigurationScheduler

        public ConfigurationScheduler​(java.lang.String name)
    • Method Detail

      • stop

        public boolean stop​(long timeout,
                            java.util.concurrent.TimeUnit timeUnit)
        Description copied from interface: LifeCycle2
        Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
        Specified by:
        stop in interface LifeCycle2
        Overrides:
        stop in class AbstractLifeCycle
        Parameters:
        timeout - the maximum time to wait
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the receiver was stopped cleanly and normally, false otherwise.
      • isExecutorServiceSet

        public boolean isExecutorServiceSet()
      • incrementScheduledItems

        public void incrementScheduledItems()
        Increment the number of threads in the pool.
      • decrementScheduledItems

        public void decrementScheduledItems()
        Decrement the number of threads in the pool
      • schedule

        public <V> java.util.concurrent.ScheduledFuture<V> schedule​(java.util.concurrent.Callable<V> callable,
                                                                    long delay,
                                                                    java.util.concurrent.TimeUnit unit)
        Creates and executes a ScheduledFuture that becomes enabled after the given delay.
        Type Parameters:
        V - The result type returned by this Future
        Parameters:
        callable - the function to execute.
        delay - the time from now to delay execution.
        unit - the time unit of the delay parameter.
        Returns:
        a ScheduledFuture that can be used to extract result or cancel.
      • schedule

        public java.util.concurrent.ScheduledFuture<?> schedule​(java.lang.Runnable command,
                                                                long delay,
                                                                java.util.concurrent.TimeUnit unit)
        Creates and executes a one-shot action that becomes enabled after the given delay.
        Parameters:
        command - the task to execute.
        delay - the time from now to delay execution.
        unit - the time unit of the delay parameter.
        Returns:
        a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
      • scheduleWithCron

        public CronScheduledFuture<?> scheduleWithCron​(CronExpression cronExpression,
                                                       java.lang.Runnable command)
        Creates and executes an action that first based on a cron expression.
        Parameters:
        cronExpression - the cron expression describing the schedule.
        command - The Runnable to run,
        Returns:
        a ScheduledFuture representing the next time the command will run.
      • scheduleWithCron

        public CronScheduledFuture<?> scheduleWithCron​(CronExpression cronExpression,
                                                       java.util.Date startDate,
                                                       java.lang.Runnable command)
        Creates and executes an action that first based on a cron expression.
        Parameters:
        cronExpression - the cron expression describing the schedule.
        startDate - The time to use as the time to begin the cron expression. Defaults to the current date and time.
        command - The Runnable to run,
        Returns:
        a ScheduledFuture representing the next time the command will run.
      • scheduleAtFixedRate

        public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate​(java.lang.Runnable command,
                                                                           long initialDelay,
                                                                           long period,
                                                                           java.util.concurrent.TimeUnit unit)
        Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on.
        Parameters:
        command - the task to execute.
        initialDelay - the time to delay first execution.
        period - the period between successive executions.
        unit - the time unit of the initialDelay and period parameters.
        Returns:
        a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation
      • scheduleWithFixedDelay

        public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay​(java.lang.Runnable command,
                                                                              long initialDelay,
                                                                              long delay,
                                                                              java.util.concurrent.TimeUnit unit)
        Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.
        Parameters:
        command - the task to execute.
        initialDelay - the time to delay first execution.
        delay - the delay between the termination of one execution and the commencement of the next.
        unit - the time unit of the initialDelay and delay parameters
        Returns:
        a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation
      • nextFireInterval

        public long nextFireInterval​(java.util.Date fireDate)
      • getExecutorService

        private java.util.concurrent.ScheduledExecutorService getExecutorService()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object