swapnilpuri / myschedule

Automatically exported from code.google.com/p/myschedule
0 stars 0 forks source link

Customized trigger data (in DB) is not deleted #115

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a customized trigger that need to save some additional data in DB
   - interface MyTrigger extends CronTrigger
   - class MyTriggerImpl extends CronTriggerImpl implements MyTrigger
   - class MyTriggerPersistenceDelegate extends CronTriggerPersistenceDelegate implements MyJDBCConstants
   - override insert, update, load, delete methods in CronTriggerPersistenceDelegate (to operate additional DB data)
2. Package all customized trigger classes into MySchedule.war
3. Schedule job with customized trigger (additional info is saved successfully 
into customized DB table)
4. Unschedule the job but record in customized DB table (for customized 
trigger) is not deleted.

What is the expected output? What do you see instead?

Delete method in MyTriggerPersistenceDelegate should be run and record in 
customized table should be deleted just like record in qrtz_cron_triggers

Please use labels and text to provide additional information.

Original issue reported on code.google.com by magicboo on 11 May 2013 at 4:23

GoogleCodeExporter commented 8 years ago
another note:
There is a setting when create DB scheduler that make 
"MyTriggerPersistenceDelegate" recognizable:

org.quartz.jobStore.driverDelegateInitString = 
triggerPersistenceDelegateClasses=org.quartz.impl.jdbcjobstore.MyTriggerPersiste
nceDelegate

Original comment by magicboo on 12 May 2013 at 7:49

GoogleCodeExporter commented 8 years ago
Hi there,

Writing your own trigger is not easy in Quartz, and you normally do not need 
it. When you write your custom trigger, you have to write all the DB logic to 
store, retrieve and delete them on your own. So no way I can support and know 
what you are doing.

Quartz comes with many triggers, and I failed to see why you would want to 
extends CrontTrigger. A more typical way of using quartz is  you store 
associate data with trigger in their DataMap, and use existing trigger. During 
the job run, you can retrieve these data map and use it in your job.

Original comment by saltnlight5 on 14 May 2013 at 1:45

GoogleCodeExporter commented 8 years ago
Hi, Thanks for your reply.

I wrote a trigger that will be triggered at a fake time when it is missed.
For example, my trigger start today but it was mis-fired @ 3/1, 4/1, 5/1, then 
it will be fired 3 times with the date in trigger's dataMap just like it was 
fired at 3/1, 4/1, and 5/1....the date is stored in my customized table in 
"MyTriggerPersistenceDelegate"

My question is that when I create a job (in script GUI) with my trigger, my 
customized table is successfully be wrote. (so that I think 
"driverDelegateInitString " setting in DB scheduler works!) But when I 
un-schedule the job, my customized table is not deleted.

This is my question and thanks for your reading...

Original comment by magicboo on 14 May 2013 at 1:06

GoogleCodeExporter commented 8 years ago
Sorry, I am still not understanding your need of custom trigger. Quartz itself 
has misfire policy you may configure.

Again, I am not sure how to help you here on custom trigger. You need to see 
Quartz source code on how custom triggers are stored and deleted. I have 
already said introducing new DB table would means you need customize their data 
store class with SQL query, which is difficult. It's not something MySchedule 
meant to solve.

Original comment by saltnlight5 on 19 May 2013 at 1:21

GoogleCodeExporter commented 8 years ago
Really thanks for your time and reply..

I knew that Quartz has its misfire policy but is not match my needs (Or I 
didn't find the suitable usage for existing policies)

I am investigating more and maybe trying to state my issue more clearly next 
time...

Original comment by magicboo on 20 May 2013 at 6:16

GoogleCodeExporter commented 8 years ago

Original comment by saltnlight5 on 11 Jun 2013 at 10:46