Class ConfigurationScheduler

java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.config.ConfigurationScheduler
All Implemented Interfaces:
LifeCycle, LifeCycle2

public class ConfigurationScheduler extends AbstractLifeCycle
  • Constructor Details

    • ConfigurationScheduler

      public ConfigurationScheduler()
    • ConfigurationScheduler

      public ConfigurationScheduler(String name)
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface LifeCycle
      Overrides:
      start in class AbstractLifeCycle
    • stop

      public boolean stop(long timeout, 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> ScheduledFuture<V> schedule(Callable<V> callable, long delay, 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 ScheduledFuture<?> schedule(Runnable command, long delay, 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, 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, Date startDate, 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 ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, 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 ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, 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(Date fireDate)
    • toString

      public String toString()
      Overrides:
      toString in class Object