| Author |
Message |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 10:39:24
|
qwerty53
journeyman
Joined: 03/22/2012 07:34:59
Messages: 47
Offline
|
hi,
qrtz 1.8 Is there a way to get a snapshot of QRTZ_FIRED_TRIGGERS table?
What I am looking for in particular is a way to get ALL trigger info with their respective fired time (and states too if possible).
Thanks.
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 15:53:14
|
light5
ophanim
Joined: 01/14/2011 20:32:56
Messages: 513
Offline
|
I dont think you can. That table is internal to quartz.
Plugin, Job and trigger listeners should satisfy most use cases. What are you trying to do?
|
Zemian Deng
---------------
Looking for a web UI to manage Quartz?
Try http://code.google.com/p/myschedule |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 17:08:23
|
qwerty53
journeyman
Joined: 03/22/2012 07:34:59
Messages: 47
Offline
|
light5 wrote:
I dont think you can. That table is internal to quartz.
Plugin, Job and trigger listeners should satisfy most use cases. What are you trying to do?
I need to know the unique identifiers of tyhe running triggers and their respective start times
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 19:07:42
|
light5
ophanim
Joined: 01/14/2011 20:32:56
Messages: 513
Offline
|
Then use the TriggerListener.
|
Zemian Deng
---------------
Looking for a web UI to manage Quartz?
Try http://code.google.com/p/myschedule |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 19:28:32
|
qwerty53
journeyman
Joined: 03/22/2012 07:34:59
Messages: 47
Offline
|
light5 wrote:
Then use the TriggerListener.
It won't help me.
What I am doing is trying to implement expirable triggers. For example if a job is stuck in some I/O operation for more then 30 min. I want to delete its trigger (because it doesn't seem possible to kill the thread itself).
With listener I would need to maintain a local copy like a map of triggers and their start times. I don't see a reason to do it if its all in the DB anyways.
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 19:59:53
|
light5
ophanim
Joined: 01/14/2011 20:32:56
Messages: 513
Offline
|
I need to know the unique identifiers of tyhe running triggers and their respective start times
Well, TriggerListener answers what you asked as that.
What I am doing is trying to implement expirable triggers. For example if a job is stuck in some I/O operation for more then 30 min. I want to delete its trigger (because it doesn't seem possible to kill the thread itself).
Well, this is not what your topic is asked about, and TriggerListener might not help here.
If you system is free to create any thread you want, you can something like this in your Job implementation:
Code:
public void execution(JobExecutionContext ctx) {
final MyIoWork work = new MyIoWork();
Thread t = new Thread(new Runnable() {
public void run() {
work.start();
}
}
t.start();
while (!work.isDone() && System.currentTimeMllis() < MAX_TIMEOUT)
Thread.sleep(500);
if (!work.isDone())
t.interrupt();
}
This would work only if your MyIoWork.start() implementation would able to exit your IO block code when running thread is interrupted. But at least you are not prevent by any Quartz related issues. It would become only a general Java and IO blocking issue to solve.
If you your system that running Quartz won't allow you to create Thread freely, then try looking into InterruptableJob as well. You can interrupt your Job at any time by calling org.quartz.Scheduler.interrupt(jobKey), instead of fixed timeout period as above. Again, you must write your Job/Work code to allow to be interrupted in order for the Job to exit.
|
Zemian Deng
---------------
Looking for a web UI to manage Quartz?
Try http://code.google.com/p/myschedule |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 20:02:19
|
qwerty53
journeyman
Joined: 03/22/2012 07:34:59
Messages: 47
Offline
|
That's the problem. I need to know WHEN to interrupt
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 20:04:39
|
light5
ophanim
Joined: 01/14/2011 20:32:56
Messages: 513
Offline
|
That's the problem. I need to know WHEN to interrupt
You interrupt when it exceed your timeout period, which you said 30 mins for example above.
|
Zemian Deng
---------------
Looking for a web UI to manage Quartz?
Try http://code.google.com/p/myschedule |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 20:06:20
|
qwerty53
journeyman
Joined: 03/22/2012 07:34:59
Messages: 47
Offline
|
Yes but how do I know when the jobs started (trigger fired). That is the whole question
|
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 20:13:55
|
light5
ophanim
Joined: 01/14/2011 20:32:56
Messages: 513
Offline
|
The trigger starts as you configured it to be. If you use cron trigger with "0 0 0 * * ?", then it starts at midnight.
Also, your Job.execution(JobExecutionContext ctx) starts when the trigger is fired, so do a time stamp with first statement as "long startTime = System.currentTimeMillis();", that's the time it start.
|
Zemian Deng
---------------
Looking for a web UI to manage Quartz?
Try http://code.google.com/p/myschedule |
|
|
 |
![[Post New]](/forums/templates/default/images/icon_minipost_new.gif) 04/16/2012 20:53:24
|
qwerty53
journeyman
Joined: 03/22/2012 07:34:59
Messages: 47
Offline
|
but again. Were do I keep the info?
after 30 minutes and maybe after the restart of the jvm I want to be able to get the info from the fired_triggers table
|
|
|
 |
|
|