简体   繁体   English

Websphere ScheduledExecutorService线程

[英]Websphere ScheduledExecutorService Thread

If I use the following code to asynchronously run a job at scheduled interval in Websphere, it is my understanding that this creates a thread outside of the Websphere JEE context, because this thread is not able to find datasources etc configuered in Websphere. 如果我使用以下代码在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);

My question is if I shutdown websphere, does the thread created for scheduled service dies or does it keep running because it was created outside of the JEE context. 我的问题是我是否关闭Websphere,为计划服务创建的线程是否死亡或由于它是在JEE上下文之外创建的而继续运行。

如果您关闭Websphere,则基本上意味着您关闭了运行JVM的进程,因此将停止其中运行的每个线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM