@Override public void contextDestroyed(ServletContextEvent sce) { leitor.parar(); try { tLeitor.join(); } catch (InterruptedException e) { e.printStackTrace(); } SingleConector.finalizar(); super.contextDestroyed(sce); }
@Override public void contextInitialized(ServletContextEvent sce) { super.contextInitialized(sce); ServletContext sc = sce.getServletContext(); String libPath = sc.getRealPath("/WEB-INF/lib"); SingleConector.iniciarComunicacoRF(libPath); leitor = new LeitorAssincrono(); tLeitor = new Thread(leitor); tLeitor.start(); }
@Override public void contextDestroyed(ServletContextEvent sce) { System.out.println("LightSaver: finalizando aplicação..."); leitor.parar(); try { tLeitor.join(); } catch (InterruptedException e) { e.printStackTrace(); } SingleConector.finalizar(); super.contextDestroyed(sce); }