--- /dev/null
+package compbio.listeners;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+import compbio.cassandra.CassandraCreate;
+
+/**
+ * Application Lifecycle Listener implementation class ContextListener
+ *
+ */
+@WebListener
+public class ContextListener implements ServletContextListener {
+ private ScheduledExecutorService scheduler;
+ CassandraCreate cc = new CassandraCreate();
+
+ /**
+ * @see ServletContextListener#contextInitialized(ServletContextEvent)
+ */
+ public void contextInitialized(ServletContextEvent arg0) {
+ System.out.println("ProteoCache session start......");
+ cc.Connection();
+
+ scheduler = Executors.newSingleThreadScheduledExecutor();
+ scheduler.scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run() {
+ cc.Parsing();
+ }
+ }, 0, 60, TimeUnit.SECONDS);
+ }
+
+ /**
+ * @see ServletContextListener#contextDestroyed(ServletContextEvent)
+ */
+ public void contextDestroyed(ServletContextEvent arg0) {
+ cc.Closing();
+ System.out.println("Shut down ProteoCache......");
+ scheduler.shutdownNow();
+ }
+
+}