2017-11-22 1 views
0

ManagedExecutorService를 사용하여 응용 프로그램의 Runnable을 관리하고 있습니다. 새 코드를 배포하면 응용 프로그램이 재구성되지만 ManagedExecutorService에 나열된 Runnables가 취소되지 않습니다. 응용 프로그램이 재구성 되었기 때문에 Runnables가 멈추지 않아야합니까? Runnables를 구성하는 기본 Java 코드는 배포시 변경 될 수 있습니다.Glassfish 4.1.0 Eclipse Neon 3을 사용한 응용 프로그램 배포 및 ManagedExecutorService

답변

0

서버가 응용 프로그램 파괴 될 때 호출되는 응용 프로그램 확장에 구성원 추가 :

public class MyApplication extends Application { 
    // override stuff for application like getProperties() etc... 
    @PreDestroy 
    public void preDestroy() { 
     // cancel all the Future<?> objects in the ManagedExecutorService 
    } 
} 
관련 문제