Websphere ScheduledExecutorService线程

时间:2018-03-17 14:45:39

标签: java multithreading websphere threadpool scheduledexecutorservice

如果我使用以下代码在Websphere中以预定的时间间隔异步运行作业,我理解这会在Websphere JEE上下文之外创建一个线程,因为此线程无法在Websphere中找到配置的数据源等。

    final Runnable beeper = new Runnable() {
       public void run() { System.out.println("beep"); }
     };
    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
    scheduler.scheduleAtFixedRate(beeper, 10, 10, SECONDS);

我的问题是,如果我关闭websphere,为计划服务创建的线程是否会死,或者它是否继续运行,因为它是在JEE上下文之外创建的。

1 个答案:

答案 0 :(得分:1)

如果关闭websphere,它基本上意味着你关闭运行JVM的进程,这样就会停止运行它的每个线程。