// This is where we instanciate a java.util.Timer
// for scheduling recurring checks of email accounts.
// it is a daemon thread, that will not prolong the life of the application.
// This means we don't need to explicitly clean it up at the end.
// It will just die it's meaningless death.
Timer supportEmailTimer = new Timer(true);
// schedule a job to check support email every x minutes
int supportInterval = 0;
try {
SupportHelperHome supportHome = (SupportHelperHome)CVUtility.getHomeObject("com.centraview.support.helper.SupportHelperHome", "SupportHelper");
SupportHelper supportRemote = supportHome.create();
supportRemote.setDataSource(dataSource);
supportInterval = supportRemote.getSupportEmailCheckInterval();
} catch (Exception e) { }
if (supportInterval > 0) {
// minutes to seconds, then seconds to miliseconds...
Integer interval = new Integer(supportInterval * 60 * 1000);
// 600000L = 10 minutes * 60 seconds/minute * 1000 miliseconds/second
// delay the first check for 10 minutes after the startup.
// Just to give things time to settle down.
TimerTask supportEmailTask = new SupportEmailCheck(dataSource);
supportEmailTimer.schedule(supportEmailTask, 600000L, interval.longValue());
siteInfo.setSupportEmailTask(supportEmailTask);
}
// now stick the Timer into the Settings Singleton so that
// it can be accessed by anything in the Tomcat4 webapp classloader.