1 package compbio.listeners;
3 import java.io.IOException;
4 import java.util.concurrent.Executors;
5 import java.util.concurrent.ScheduledExecutorService;
6 import java.util.concurrent.TimeUnit;
8 import javax.servlet.ServletContextEvent;
9 import javax.servlet.ServletContextListener;
10 import javax.servlet.annotation.WebListener;
12 import compbio.cassandra.CassandraNativeConnector;
13 import compbio.engine.ProteoCachePropertyHelperManager;
14 import compbio.util.PropertyHelper;
17 * Application Lifecycle Listener implementation class ContextListener
21 public class ContextListener implements ServletContextListener {
22 private ScheduledExecutorService webjob_scheduler;
23 CassandraNativeConnector db = new CassandraNativeConnector();
24 static PropertyHelper ph = ProteoCachePropertyHelperManager.getPropertyHelper();
27 * @see ServletContextListener#contextInitialized(ServletContextEvent)
29 public void contextInitialized(ServletContextEvent arg0) {
30 System.out.println("ProteoCache session start......");
33 webjob_scheduler = Executors.newSingleThreadScheduledExecutor();
34 webjob_scheduler.scheduleAtFixedRate(new Runnable() {
39 } catch (IOException e) {
40 // TODO Auto-generated catch block
44 }, 0, 600, TimeUnit.SECONDS);
49 * @see ServletContextListener#contextDestroyed(ServletContextEvent)
51 public void contextDestroyed(ServletContextEvent arg0) {
53 System.out.println("Shut down ProteoCache......");
54 webjob_scheduler.shutdownNow();