-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 6.2.10 EE GA1, 6.2.X EE, 7.0.0 Alpha 1
-
Fix Version/s: 6.2.X EE
-
Branch Version/s:6.2.x
-
Backported to Branch:Committed
-
Fix Priority:5
-
Git Pull Request:
Steps to reproduce
1) enable clustering cluster.link.enabled=true
2) unzip sample-scheduler-portlet into liferay sdk
2) open up sample scheduler liferay-portlet.xml and set the time to be 3 min in the future (enough time to get through the deployment
3) build and deploy the sample scheduler portlet (you may need to comment out license=ee requirement in plugin-package-properties)
4) confirm that at the designated time, the job executes by printing out a message to the log
5) use script to change between slave and master
for master you have to set up a cluster with two nodes and have the nodes change between master and slave by taking them down and up again
if you are using an IDE and a breakpoint to call initMemoryClusterJobs() before the scheduled jobs are deleted in ClusterSchedulerEngine then you can use the following script
import com.liferay.portal.kernel.cluster.ClusterMasterExecutorUtil executor = ClusterMasterExecutorUtil.getClusterMasterExecutor() executor.notifyMasterTokenTransitionListeners(false) executor.notifyMasterTokenTransitionListeners(true)
script for 6.2
import java.lang.reflect.Proxy import com.liferay.portal.kernel.scheduler.SchedulerEngineHelperUtil import com.liferay.portal.messaging.proxy.MessagingProxyInvocationHandler import com.liferay.portal.scheduler.ClusterSchedulerEngine import com.liferay.portal.spring.aop.ServiceBeanAopProxy schedulerEngine = SchedulerEngineHelperUtil.getSchedulerEngineHelper()._schedulerEngine while (schedulerEngine.getClass() != ClusterSchedulerEngine.class) { invocationHandler = Proxy.getInvocationHandler(schedulerEngine) if (invocationHandler instanceof ServiceBeanAopProxy) { schedulerEngine = invocationHandler._advisedSupport.getTargetSource().getTarget() } else { println "Failed to unwrap class: " + invocationHandler.getClass() break } } if (schedulerEngine.getClass() == ClusterSchedulerEngine.class) { masterAddressString = schedulerEngine.getMasterAddressString(false) schedulerEngine.masterToSlave(masterAddressString, false) println "Switched from master to slave" schedulerEngine.slaveToMaster() println "Switched from slave to master" }
Expected behavior: since the job has already been run, there should not be any additional messages in the log saying that a job has been executed
Actual behavior: a new message prints in the log indicating that a new job has been executed
- relates
-
LPE-14318 Scheduled job executes on both nodes
-
- Closed
-