[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
JobListener's jobWasExecuted is invoked before finishing the job  XML
Forum Index -> Quartz
Author Message
amyusoof

journeyman

Joined: 08/11/2010 03:39:44
Messages: 16
Offline

Hi,


I am using Quartz scheduler to run the some tasks at specified time.

I have created one job which takes the records from db and process it and then update the status to the db again. due to huge amount of data im using Executor threads to pickup and process records from db.

My problem is i have one joblistener for above mentioned job, jobWasExecuted() method of joblistener is invoked before executing all the threads in the job. After the threads has been started the joblistener is invoked. i want to invoke the job listener only after executing and completing all the threads in the job.

Please suggest me how to delay the joblistener to invoke jobWasExecuted() only after executing all the threads in the job .


Thanks in advance.
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1654
Offline

The listener is notified of completion as soon as the job's execute() method returns. Since you're returning from the execute() method Quartz notifies the listener because it has now way to know that you have span-off other threads to do work.

If you want the listener notified when all of your spawned threads complete, then you need to not return from the execute method until they complete. Perhaps the Thread.join() method may be useful to you.
amyusoof

journeyman

Joined: 08/11/2010 03:39:44
Messages: 16
Offline

Thanks for your reply.. i solved it by using Executor's isTerminated method.

 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team