/** * Run the scheduler with the provided period of time. If the scheduler is already started, it will be stopped (not * before the running job is complete). * * @param period * new period for scheduling. * @param timeUnit * what kind of time unit is associated with the period. */ public SchedulerHelper scheduleWithPeriod(final long period, final TimeUnit timeUnit) { notNull(timeUnit); LOG.debug("period: {} [{}]", period, timeUnit); if (this.period != period) { this.period = period; if (!poolInitializer.get().isShutdown()) { startScheduler(period, timeUnit); } else { LOG.warn("Cannot schedule because destroy was already called!"); } } return this; }
/** * Run the scheduler with the provided period of time. If the scheduler is already started, it will be stopped (not * before the running job is complete). * * @param period * new period for scheduling. * @param timeUnit * what kind of time unit is associated with the period. */ public SchedulerHelper scheduleWithPeriod(final long period, final TimeUnit timeUnit) { notNull(timeUnit); LOG.debug("period: {} [{}]", period, timeUnit); if (this.period != period) { this.period = period; if (!poolInitializer.get().isShutdown()) { startScheduler(period, timeUnit); } else { LOG.warn("Cannot schedule because destroy was already called!"); } } return this; }