Examples of JMXEnabledScheduledThreadPoolExecutor


Examples of org.apache.james.util.concurrent.JMXEnabledScheduledThreadPoolExecutor

            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 {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.