// "Oh we're not gonna take it... No, we ain't gonna take it... Oh we're not gonna take it anymore..."
}
SettingsInterface settings = Settings.getInstance();
// re-schedule JOB because it is currently running and
// we have changed the interval at which it executes
TimerTask supportEmailTask = settings.getSupportEmailTask();
Timer supportEmailTimer = settings.getSupportEmailTimer();
// cancel the existing timer.
if (supportEmailTask != null) {
supportEmailTask.cancel();
}
if (supportEmailTimer != null) {
supportEmailTimer.cancel();
}
// only re-schedule the job if the interval is greater than zero
// a zero value means do not check support email ever
if (formInterval.intValue() > 0) {
// minutes to seconds, seconds to miliseconds
Integer interval = new Integer(formInterval.intValue() * 60 * 1000);
// then create a new Timer.
Timer newSupportEmailTimer = new Timer(true);
// wait a full two minutes for the next execution.
TimerTask newSupportEmailTask = new SupportEmailCheck(dataSource);
newSupportEmailTimer.schedule(newSupportEmailTask, 120000L, interval.longValue());
// And store our reference.
settings.setSupportEmailTimer(newSupportEmailTimer);
settings.setSupportEmailTask(newSupportEmailTask);
}