gpt4 book ai didi

java - Websphere 6.1集群环境下如何运行定时任务

转载 作者:行者123 更新时间:2023-11-30 11:58:12 24 4
gpt4 key购买 nike

我想从部署在 Websphere 6.1 集群环境中的 Web 应用程序的某个时间间隔运行后台任务。该任务将访问数据库、发送电子邮件并写入数据库。

我正在考虑在首次加载 Web 应用程序时启动一个线程,如下所示:Background Thread for a Tomcat servlet app .

由于它是一个集群环境,不让任务在集群的每个单独节点上运行的最佳方法是什么?

最佳答案

看看 WAS Scheduler service .

它说集群环境:

Scheduler daemons in a cluster

When multiple schedulers are configured to use the same tables (as is the case in a clustered environment), any of the daemons can find a task and set the alarm in its Java virtual machine (JVM). The task is executed in the virtual machine where the scheduler daemon first runs, until the daemon is stopped and another daemon starts. If an application on server1 schedules a task to run and server2 was started before server1, then the task runs on server2.

关于java - Websphere 6.1集群环境下如何运行定时任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3312386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com