내가 예약 된 스레드를 실행하는 데 ScheduledExecutorService
을 사용하고 있습니다.
나는 ServletContextListener.contextDestroyed
을 구현 ScheduledExecutorService.shutdownNow
및 awaitTermination
를 호출. 여기 톰캣 7 ScheduledExecutorService.shutdown
이 로그는 무시 할 수 있습니까? 아니면 내가 잘못하고있는거야?SEVERE : : 아직도
@Override public void contextDestroyed(ServletContextEvent servletcontextevent) { pool.shutdownNow(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!pool.awaitTermination(50, TimeUnit.SECONDS)) { pool.shutdownNow(); // Cancel currently executing tasks System.err.println("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted pool.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }
, 내가 톰캣 7에서 다음과 같은 오류가 발생하고 웹 응용 프로그램 [/ 서블릿은]을 시작했습니다 보인다 [Timer-0]이라는 스레드가 스레드를 중지하지 못했습니다. 메모리 누수가 발생할 가능성이 높습니다 ( ).
감사
제 생각은 정리를하기위한 당신의 책임은 어디에서 멈 춥니 까? 그 밖의 무엇이 여기에서 끝날 수 있습니까? 소방 호스로 상자에 닿았나요? 모든 진지함을 말하자면, 당신이 할 수있는 모든 일을하는 것처럼 보입니다 ... 나는 그 오류를 무시할 것입니다. – ControlAltDel
내 이전 게시물을 참조 할 수 있습니다 :) http://stackoverflow.com/questions/9926356/scheduledexecutorservice-when-shutdown-should-be-invoked – lili