留言板

How to change the scheduling job interval time after server startup

thumbnail
Nagendra Kumar Busam,修改在14 年前。

How to change the scheduling job interval time after server startup

Liferay Master 帖子: 678 加入日期: 09-7-7 最近的帖子
Hi,

By following the blog @ Scheduling

I have created a custom portlet, in configuration section of that portlet i am changing the interval time
and it was not reflecting in scheduled job which started at server startup (i was able to get changed value in my schedule job execute method which implements IntervalJob)

Please let me know how to achieve above functionality

Thanks,
- Nagendra Kumar
thumbnail
Arvind Mishra,修改在14 年前。

RE: How to change the scheduling job interval time after server startup

Regular Member 帖子: 226 加入日期: 08-2-13 最近的帖子
I dont have your code , But you take case of Calendar Portlet .


This is the piece of code which decide the internal



public class CheckEventJob implements IntervalJob {

	public static final long INTERVAL = GetterUtil.getLong(PropsUtil.get(
		PropsKeys.CALENDAR_EVENT_CHECK_INTERVAL)) * Time.MINUTE;



PropsKeys.CALENDAR_EVENT_CHECK_INTERVAL - This is coming from portal.properties


Thanks
Arvind
thumbnail
Nagendra Kumar Busam,修改在14 年前。

RE: How to change the scheduling job interval time after server startup

Liferay Master 帖子: 678 加入日期: 09-7-7 最近的帖子
Thank you very much for the quick reply

Please find my code for my scheduler job which is implementing IntervalJob


public class SyncNewsJob implements IntervalJob {

	public static long INTERVAL = GetterUtil.getLong(PropsUtil.get("xyz.news.synch.time")) * Time.MINUTE;
	List<xyznewsxml> records = null;
	XYZNewsXml record =  null;
	
	
	public SyncNewsJob(){
		try {
			records = XYZNewsXmlLocalServiceUtil.getAll();
			if (records.size() != 0){
				record = records.get(0);
				INTERVAL = record.getScheduleInterval()* Time.MINUTE; // scheduling in minutes
			}
		} catch (SystemException e) {
			_log.error(e);
		}
	}
	public void execute(JobExecutionContext context) {
		try {
			if (records.size() != 0){
				record = records.get(0);
				scheduleJobId = record.getScheduleJobId();

				XYZSchedulerUtil.addOrUpdateArticles(null, record.getFeedUrl(), record.getUserId(),
						record.getGroupId(), record.getCompanyId(), record.getPlid(), record.getPortalURL() );
			}
		catch (Exception e) {
			_log.error(e);
		}
	}
</xyznewsxml>


I was able to get my changed schedule interval after server startup in these methods BUT it was not reflecting scheduler job execution.

Is there any way to get the current thread which running present scheduling job for my custom code.

Thanks,
- Nagendra Kumar
thumbnail
Nagendra Kumar Busam,修改在14 年前。

RE: How to change the scheduling job interval time after server startup

Liferay Master 帖子: 678 加入日期: 09-7-7 最近的帖子
Any help on this topic?


Thanks,
- Nagendra Kumar
Gopal Brijesh,修改在14 年前。

RE: How to change the scheduling job interval time after server startup

New Member 帖子: 3 加入日期: 10-2-25 最近的帖子
Nagendra, Did you figure out a way to do this?

- Brij.G

Nagendra Kumar Busam:
Any help on this topic?


Thanks,
- Nagendra Kumar