How to clear triggers in Quartz Scheduler

If I have a Quartz scheduler working with a bunch of triggers and I want to clear all triggers, what is the best way to do this?

I considered iterating over groups and names, calling them inhuman, but it seems very slow when there are thousands of triggers (about 2 seconds to unlink 10 triggers).

The simplest test example (the schedule of 1000 triggers, deleting batches from 100) shows the exponential complexity wrt the number of scheduled triggers in a non-urgent operation:

Deleted 100 triggers in 3594ms,35.94 triggers/ms
Deleted 100 triggers in 2734ms,13.67 triggers/ms
Deleted 100 triggers in 2453ms,8.176666666666666 triggers/ms
Deleted 100 triggers in 1985ms,4.9625 triggers/ms
Deleted 100 triggers in 1547ms,3.094 triggers/ms
Deleted 100 triggers in 1281ms,2.135 triggers/ms
Deleted 100 triggers in 1047ms,1.4957142857142858 triggers/ms
Deleted 100 triggers in 765ms,0.95625 triggers/ms
Deleted 100 triggers in 485ms,0.5388888888888889 triggers/ms
Deleted 100 triggers in 156ms,0.156 triggers/ms

I cannot find any mass methods to clarify the situation.

I finally thought about stopping the scheduler and cutting it out for garbage collection, but I'm not sure if there is anything else that I might need to make sure it is not mentioned anywhere.

- ?

+3
2

?

, , , , .

? SQL , .

+2

, shutdown . scheduler.shutdown(true), , . Quartz API, shutdown , .

+1

Source: https://habr.com/ru/post/1772069/


All Articles