找到你要的答案

Q:Liferay scheduler is not firing on clustering

Q:Liferay调度器不开火的聚类

I had scheduler used in portlet which will be triggering for each 5 minutes.

following are the configurations: liferay-portlet.xml:

<scheduler-entry>
  <scheduler-description>
   This scheduler is used to invoke the update and delete results
  </scheduler-description>
 <scheduler-event-listener-class>com.test.myown.scheduler.action.GetResultsScheduler</scheduler-event-listener-class>
  <trigger>
     <simple>
        <simple-trigger-value>5</simple-trigger-value>
        <time-unit>minute</time-unit>
      </simple>
  </trigger>
</scheduler-entry> 

And my class is :

  public class GetResultsScheduler implements MessageListener{
     public void receive(Message message) throws MessageListenerException {
         // some code here
     }
  }

we are using liferay 6.1,weblogic server Here the problem is, There are 2 nodes for server , Scheduler is triggering for 5 minutes in node1 There is no scheduler triggering in node 2

What I meant say is, scheduler is working in node 1 and not working in node2.

Can any one have any idea about this issue?

我曾使用portlet将每5分钟触发调度器。

following are the configurations: liferay-portlet.xml:

<scheduler-entry>
  <scheduler-description>
   This scheduler is used to invoke the update and delete results
  </scheduler-description>
 <scheduler-event-listener-class>com.test.myown.scheduler.action.GetResultsScheduler</scheduler-event-listener-class>
  <trigger>
     <simple>
        <simple-trigger-value>5</simple-trigger-value>
        <time-unit>minute</time-unit>
      </simple>
  </trigger>
</scheduler-entry> 

我的班级是:

  public class GetResultsScheduler implements MessageListener{
     public void receive(Message message) throws MessageListenerException {
         // some code here
     }
  }

we are using liferay 6.1,weblogic server Here the problem is, There are 2 nodes for server , Scheduler is triggering for 5 minutes in node1 There is no scheduler triggering in node 2

我的意思说的是,调度器节点1中的工作和不工作在node2。

任何人都有这个问题的想法?

answer1: 回答1:

I'd say this is expected: When you run some frequent jobs, you might not want to execute them concurrently on each machine, as they'll get in conflict. You've stated that the job must be executed every 5 minutes, not twice every 5 minutes (as it would be if every machine would fire it).

If you take down node1, I'd also expect node2 to take over the duty of executing the scheduled jobs. This will be a good test for the correctness of the assumption stated above.

Also, you shouldn't rely on such jobs to execute in each VM (probably manipulating common state, shared through the classloader). If you modify content that is cached, the cluster communication should take care to invalidate the classes.

If you have problems with this, you're either violating that (my) assumption of the global state in the VM, or you've not configured the cluster cache invalidation correctly.

我想这是意料之中的:当你运行一些频繁的工作时,你可能不想在每个机器上同时执行它们,因为它们会发生冲突。你已经说过,这项工作必须每5分钟执行一次,不是每5分钟两次(因为如果每台机器都会开火)。

如果你把node1,我还指望NODE2接管执行预定的工作职责。这将是对上述假设的正确性的一个很好的检验。

另外,你不应该依靠这样的工作在每个虚拟机执行(可能控制常见的状态,通过类加载器共享)。如果你修改的内容是缓存,集群通信应注意使类。

如果您对此有问题,您要么违反了(我)假设VM中的全局状态,要么您没有正确配置群集缓存失效。

liferay  quartz-scheduler  liferay-6  weblogic-10.x