如何在一个节点和全部的群集中运行计划方法? [英] How to run a Scheduled Method in a Cluster for one Node and for All?
问题描述
- 一种每天只运行一次(在单个节点上) / li>
- 和所有节点上运行的其他类型(每1-2分钟) - 他们不需要运行syncron方式!这个要求只是在每个节点上运行。
我不知道如何从这个集群开始 - 问题是这是可能用 @Schedule
(以及如何)或需要其他东西?
我遇到完全相同的问题(需要一个集群
计时器和一个每个节点
计时器),并遇到这个题。所以,对于任何有兴趣的人:
如果你使用@Schedule(...,persistent = true)声明定时器,你将得到一个集群
定时器存储在定时器db(可以迁移)中
如果您使用@Schedule(...,persistent = false)声明定时器),您将得到一个不存储在定时器db(不能迁移)的节点
定时器
I have a Glassfish 3.1.2 that runs in a cluster and a EJB 3.1 application. And I need two kind of Scheduled Methods in my application:
- one kind that runs only once (on a single node) once a day
- and other kind that runs on all nodes (every 1-2 Minutes) -- They do NOT need to run a syncron way! The requirement is just that this kind run on every node.
I have no clue how to start with this cluster - problem, is this possible with @Schedule
(and how) or do I need something else?
I faced the exact same issue (need one cluster
timer and a per node
timer) and came across this question. So, for anyone interested:
If you declare the timer with @Schedule(..., persistent=true), you will get a cluster
timer stored in the timer db (which can be migrated)
If you declare the timer with @Schedule(..., persistent=false), you will get a node
timer not stored in the timer db (which can't be migrated)
这篇关于如何在一个节点和全部的群集中运行计划方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!