Stopping StdSchedulerFactory waits for jobs to finish

961 views
Skip to first unread message

Pablo Szittyay

unread,
Dec 20, 2011, 1:22:34 PM12/20/11
to Quartz.NET
Hi, i am using the version 2.0 of Quartz. It is running inside a
windows service.

The following are the override methos of ServiceBase:

protected override void OnContinue()
{
this.scheduler.ResumeAll();
}

protected override void OnPause()
{
this.scheduler.PauseAll();
}

protected override void OnStart(string[] args)
{
this.scheduler.Start();
this.log.Information("Se ha iniciado el servicio");
}

protected override void OnStop()
{
this.scheduler.Shutdown(false);<----WHEN STOPPING THE
SERVICE SHOULD CANCEL ALL THE THREADS!!!!
this.log.Information("Se ha detenido el servicio");
}


But the problem is that when stopping the service, it waits for al
services to finish!!!

Jason Meckley

unread,
Dec 20, 2011, 5:30:28 PM12/20/11
to quar...@googlegroups.com
yes, it tries to shut down gracefully letting the current running jobs finish. but it won't start any new jobs.

Pablo Szittyay

unread,
Dec 20, 2011, 6:22:48 PM12/20/11
to quar...@googlegroups.com
Yes i have read the code to see what the parameter did. But the name of the parameter is not the best  waitForJobsToComplete . because setting it to false, gives the idea that it will stop immediatly

El 20 de diciembre de 2011 19:30, Jason Meckley <jasonm...@gmail.com> escribió:
yes, it tries to shut down gracefully letting the current running jobs finish. but it won't start any new jobs.

--
You received this message because you are subscribed to the Google Groups "Quartz.NET" group.
To view this discussion on the web visit https://groups.google.com/d/msg/quartznet/-/HuOK-a7nuEQJ.

To post to this group, send email to quar...@googlegroups.com.
To unsubscribe from this group, send email to quartznet+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/quartznet?hl=en.



--
Saludos
Pablo Szittyay

Luke

unread,
Dec 20, 2011, 9:54:14 PM12/20/11
to Quartz.NET
My suggestion would be to:

a) Check in code if there are any comments or attempts to in fact do
what you described. (Property name sort of gives it away)
b) While you at it and you believe something is not working, fix it!
That's how open source works I'm afraid.
c) Commit it / Push if you think it works fine.

Marko Lahma

unread,
Dec 28, 2011, 4:07:55 PM12/28/11
to quar...@googlegroups.com
Quartz tries to kill threads in a orderly fashion by default, which
means waiting. You could try setting:

properties["quartz.threadPool.makeThreadsDaemons"] = "true";

Which will effectively kill thread pool threads sooner. Another option
is to implement IInterruptableJob which allows faster termination of
your jobs (if implemented correctly).

-Marko

> --
> You received this message because you are subscribed to the Google Groups "Quartz.NET" group.

Matthew White

unread,
Mar 7, 2012, 4:57:01 AM3/7/12
to quar...@googlegroups.com
I am trying to use Quartz.net as a Clustered Oracle backed Windows Service.
 
I also am finding that Quartz is difficult to kill. Even when the only scheduled job is Xml FileScan job, and that is not running, the Windows Service Manager seems to report an error (I've even tried 'requesting additional time' from the service manager).
 
What does the "ThreadsDaemon" option do ?

Mark Gillen

unread,
Mar 7, 2012, 10:32:24 AM3/7/12
to quar...@googlegroups.com
I believe there is a boolean flag passed to schedulre shutdown method that if set to true pauses the scheduler but prevents the service from shutting down until all threads have completed.

Not sure if this entirely addresses your problem but you may have a job thread that is blocking the main service from shutting down.

Best Regards,
Mark Gillen

> --
> You received this message because you are subscribed to the Google Groups "Quartz.NET" group.

> To view this discussion on the web visit https://groups.google.com/d/msg/quartznet/-/J8HGEoR9sLEJ.

Marko Lahma

unread,
Mar 7, 2012, 1:43:23 PM3/7/12
to quar...@googlegroups.com
Property MakeThreadsDaemons changes threads created by target
(SimpleThreadPool and JobStoreSupport support this property) to daemon
threads, a.k.a. background thread. These threads are killed when main
application exists. But it sounds that you have some jobs that hang or
something similar that prevents clean shutdown.

-Marko

Reply all
Reply to author
Forward
0 new messages