Class SchedulerUtil

java.lang.Object
de.tsl2.nano.util.SchedulerUtil

public class SchedulerUtil extends Object
simple delegator to ScheduledExecutorService.
Version:
$Revision$
Author:
Tom
  • Constructor Details

    • SchedulerUtil

      public SchedulerUtil()
  • Method Details

    • runAt

      public static final ScheduledFuture<?> runAt(long timeOnUnit, long end, TimeUnit unit, Runnable command)
      runs the given command at given time on given unit. example: timeOnUnit=2*60*60*1000, unit=TimeUnit.DAY --> command will be started each day at 2 o'clock.
      Parameters:
      timeOnUnit -
      end - end time (stopping task). if end = -1, no stopping task will be created
      unit - time unit
      command - command to execute
      Returns:
      future
    • runAt

      public static final ScheduledFuture<?> runAt(long delay, long period, long end, TimeUnit unit, Runnable command)
      runAt see {@link ScheduledExecutorService#scheduleAtFixedRate(Runnable, long, long, TimeUnit).}
      Parameters:
      delay - wait time for first start
      period - period time
      end - end time (stopping task). if end = -1, no stopping task will be created
      unit - time unit
      command - command to execute
      Returns:
      future