String jmxPath = "org.apache.james:type=component,name=" + jmxName + ",sub-type=threadpool";
/*
The scheduler service that is used to trigger fetch tasks.
*/
ScheduledExecutorService scheduler = new JMXEnabledScheduledThreadPoolExecutor(numThreads, jmxPath, "scheduler");
MailQueue queue = queueFactory.getQueue(MailQueueFactory.SPOOL);
List<HierarchicalConfiguration> fetchConfs = conf.configurationsAt("fetch");
for (HierarchicalConfiguration fetchConf : fetchConfs) {
// read configuration
Long interval = fetchConf.getLong("interval");
FetchMail fetcher = new FetchMail();
fetcher.setLog(logger);
fetcher.setDNSService(dns);
fetcher.setUsersRepository(urepos);
fetcher.setMailQueue(queue);
fetcher.setDomainList(domainList);
fetcher.configure(fetchConf);
// initialize scheduling
schedulers.add(scheduler.scheduleWithFixedDelay(fetcher, 0, interval, TimeUnit.MILLISECONDS));
}
if (logger.isInfoEnabled())
logger.info("FetchMail Started");
} else {