shuyangzhou/liferay-portal — pull request #58 by tinatian (2012-03-02 15:06:25+00:00)
Title: LPS-25793 Memory jobs of scheduler are triggered by more than one nodes when using cluster at the same time, it should be triggered by one node.

Hi Shuyang,

There are two commits:

1) The call back methods from jgroups in ClusterRequestReceiver are using variables that initialized in ClusterExecutor.initialize(), they may be invoked before or during ClusterExecutor.initialize(). That's the reason why I can not see the log when starting up, there is a NPE caught by jgroups.

2) Lucene problem is caused by dead lock.
When node1 receives a request from node2 and find node2 come, the ClusterEventListeners are fired, in lucene's listener, it sends another request by jgroups and waits for its responses to move on, but jgroups is using a single thread to process the messages from node2, so even node2 has already sent the response to node1, node1 can not process it until the current job is done(that's why I can see response out of time).

The fix is to separate long time task from jgroups' thread, make it return as soon as possible and then deal with new messages. That's what we did when we fix the gc problem, but that time we just separate the process of ClusterResquest, we also need to separate ClusterEvenetListeners from it.

I have tested all, it works for me.