Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Multiple Portal Instances - Cron Scheduler
Hi All
I have a question regarding cron/quartz scheduler in Liferay 6.1.1 CE GA2. How does it work with multiple instances / shard enabled ? Does the cron run for *every* instance automatically ? or it runs in central/portal space, and multiple instances needs to be handled programatically within the job ?
e.g. say there is a entity / table called alarmData and it has a column named averageTimeInAlarm. This table is created in every shard / db instance after deployment. averageTimeInAlarm is calculated in batch as a part of cron job. Now, should the cron job implementation have code to connect to each company (instance/shard) and process this, or liferay should automatically run the same cron for every instance ?
Thanks
Abhay
I have a question regarding cron/quartz scheduler in Liferay 6.1.1 CE GA2. How does it work with multiple instances / shard enabled ? Does the cron run for *every* instance automatically ? or it runs in central/portal space, and multiple instances needs to be handled programatically within the job ?
e.g. say there is a entity / table called alarmData and it has a column named averageTimeInAlarm. This table is created in every shard / db instance after deployment. averageTimeInAlarm is calculated in batch as a part of cron job. Now, should the cron job implementation have code to connect to each company (instance/shard) and process this, or liferay should automatically run the same cron for every instance ?
Thanks
Abhay
Do you have a solution for this problem?
The cron runs only for central instance. How can I run for every instance the job?
The cron runs only for central instance. How can I run for every instance the job?
Hi,
Any solution found for this issue? Can you please share your findings?
I am also facing the same for multi-tenant environment, where only central instance is running all schedulers but no other tenant have those schedulers.
Thanks,
Shuchi
Any solution found for this issue? Can you please share your findings?
I am also facing the same for multi-tenant environment, where only central instance is running all schedulers but no other tenant have those schedulers.
Thanks,
Shuchi
Phew -- 6.1, man, that's going back now. And Sharding! talk about the archives of features 
I think the answer is that it's up to you to manage. A portlet is not deployed to a particular instance or to a site. The portlet exists at the server level-- so if you have deployed a TodoList portlet, then Site A on Instance A can add it to a page, but so can Site B n Instance B. It's considered a global asset for lack of a better term.
Same goes for the scheduled task. The task itself runs at the server level so if you need to do something for one company but not another, then it'll be up to you to look up the list of company ids, or the virtual host record from which you can get the company id, etc.
Sharding shouldn't matter at all as you simple use the services that Liferay provides and that magic is hidden from you.

I think the answer is that it's up to you to manage. A portlet is not deployed to a particular instance or to a site. The portlet exists at the server level-- so if you have deployed a TodoList portlet, then Site A on Instance A can add it to a page, but so can Site B n Instance B. It's considered a global asset for lack of a better term.
Same goes for the scheduled task. The task itself runs at the server level so if you need to do something for one company but not another, then it'll be up to you to look up the list of company ids, or the virtual host record from which you can get the company id, etc.
Sharding shouldn't matter at all as you simple use the services that Liferay provides and that magic is hidden from you.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™