1 package compbio.listeners;
3 import java.util.concurrent.Executors;
4 import java.util.concurrent.ScheduledExecutorService;
5 import java.util.concurrent.TimeUnit;
7 import javax.servlet.ServletContextEvent;
8 import javax.servlet.ServletContextListener;
9 import javax.servlet.annotation.WebListener;
11 import compbio.cassandra.CassandraCreate;
14 * Application Lifecycle Listener implementation class ContextListener
18 public class ContextListener implements ServletContextListener {
19 private ScheduledExecutorService webjob_scheduler;
20 CassandraCreate cc = new CassandraCreate();
23 * @see ServletContextListener#contextInitialized(ServletContextEvent)
25 public void contextInitialized(ServletContextEvent arg0) {
26 System.out.println("ProteoCache session start......");
29 webjob_scheduler = Executors.newSingleThreadScheduledExecutor();
30 webjob_scheduler.scheduleAtFixedRate(new Runnable() {
35 }, 0, 60, TimeUnit.SECONDS);
40 * @see ServletContextListener#contextDestroyed(ServletContextEvent)
42 public void contextDestroyed(ServletContextEvent arg0) {
44 System.out.println("Shut down ProteoCache......");
45 webjob_scheduler.shutdownNow();