Fórum

Liferay scheduler get last and upcoming schedule time

thumbnail
Syed Nasar, modificado 7 Anos atrás.

Liferay scheduler get last and upcoming schedule time

Junior Member Postagens: 64 Data de Entrada: 03/09/15 Postagens Recentes
Hi,
I integrated liferay quartz scheduler in my portlet. But the thing is I need the time of last and upcoming time of scheduler call. How can I do that?
thumbnail
Andrew Jardine, modificado 7 Anos atrás.

RE: Liferay scheduler get last and upcoming schedule time

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Syed,

I've never done this specific thing you are asking, but I have done a fair amount of work with the scheduler so I am happy to try to solve the problem together. If I understand what you are saying correctly, then what you are saying is that you have configured one of your portlets to have scheduled job using the liferay-portlet.xml file yes?

Can you provide the configuration here please?

The database, as I am sure you have seen, does contain several tables prefixed with QUARTZ. One of them, QUARTZ_FIRED_TRIGGERS, but my table doesn't have anything in it and search through the source, quickly, I couldn't find any references to it other than SQL files. So in terms of records of jobs that have been run, perhaps you need to keep your own records such that when your message listener is invoked, the first thing you do is create an audit record.

To determine the upcoming call, you could then use the timestamp from your last run + your interval to determine when the next run will occur.

I also had a look at some of the API -- there is a lot of code in the com.liferay.portal.kernel.scheduler package, but most of it seems to be around the management of jobs (add, delete, pause, resume, etc). I haven't dug through every line but at first glance I didn't see anything like what you are looking for.

So in summary.
1. Last run can be done by maintaining an audit record. (even easier if you are on EE! there is an Audit portlet)
2. Next run would be some basic math.