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

标签 java web-applications websphere

我想从部署在 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/

相关文章:

asp.net-mvc - 将搜索框添加到母版页

javascript - 检测页面是在三星股票浏览器中查看还是作为独立的网络应用程序查看

web-applications - 什么是 "server application"?

java - 如何在Websphere中强制垃圾收集相关的堆转储?

java - 如何在插入包含对象集的对象列表期间忽略唯一违规

java - 在 Apache WorkbookFactory 上找不到 close() 方法

java - 在 Websphere 中的什么位置放置数据文件?

java - 如何解决由于 LTPA token 过期而导致的 Websphere Web 应用程序登录延迟?

java - 信号量不起作用

java - 我正在更新 Firebase 中一个对象的子对象,然后使用事件监听器拉取同一对象,但它没有更新 UI?