/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.common.filter;

import Controller.LoginServlet;
import Dao.LogOutDao;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;


/**
 *
 * @author 1004242
 */
@WebListener
public class ServerDownEventListener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent event) {
            //TODO ON START
        }
        public void contextDestroyed(ServletContextEvent event) {
            LogOutDao lDao = new LogOutDao();
            int result = 0;
            result = lDao.removeFromLoggedInUsers(null, null, 0);
            LoginServlet.sesssionMap.clear();
            System.out.println("User session closed  from logged_in_users for session Id :" + result);
            
        }
}

