michaelklishin / quartz-mongodb

A MongoDB-based store for the Quartz scheduler. This fork strives to be as feature complete as possible. Originally by MuleSoft.
Other
249 stars 203 forks source link

supporting concurrentExectionDisallowed? #1

Closed chillenious closed 10 years ago

chillenious commented 12 years ago

Hi,

Any chance you'll be supporting concurrentExectionDisallowed any time soon?

ifesdjeen commented 12 years ago

I would say that adding it shouldn't be that big of a deal, pretty much similar to what Quartz has in other stores:

                if (job.isConcurrentExectionDisallowed()) {
                    if (acquiredJobKeysForNoConcurrentExec.contains(jobKey)) {
                        excludedTriggers.add(tw);
            continue; // go to next trigger in store.                                                                                                                                                                             
                    } else {
                        acquiredJobKeysForNoConcurrentExec.add(jobKey);
            }
// ...

                if (job.isConcurrentExectionDisallowed()) {
                    ArrayList<TriggerWrapper> trigs = getTriggerWrappersForJob(job
                            .getKey());
                    Iterator<TriggerWrapper> itr = trigs.iterator();
                    while (itr.hasNext()) {
                        TriggerWrapper ttw = itr.next();
                        if (ttw.state == TriggerWrapper.STATE_WAITING) {
                            ttw.state = TriggerWrapper.STATE_BLOCKED;
                        }
                        if (ttw.state == TriggerWrapper.STATE_PAUSED) {
                            ttw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
                        }
                        timeTriggers.remove(ttw);
                    }
                    blockedJobs.add(job.getKey());
                } else if (tw.trigger.getNextFireTime() != null) {
                    synchronized (lock) {
                        timeTriggers.add(tw);
                    }
                }

/// etc

There is a plan to support pretty much everything that other stores support. I'll take a look, and check if I could do it perhaps in the end of next week. Maybe @michaelklishin is faster than I am.

But pull requests are always welcomed!

michaelklishin commented 12 years ago

We want to make the store as feature complete as we can. Feel free to submit a pull request that adds this feature.

chillenious commented 12 years ago

Cheers, will try. Though I'm not sure when I'll have time to dive into doing that tbh, as I'd need to get familiar more with Quartz' internals.

shaulim commented 12 years ago

any news on the job execution disallowed?

michaelklishin commented 11 years ago

If someone still needs this feature, feel free to submit pull requests.

chillenious commented 11 years ago

Haven't had the need for it

liougehooa commented 11 years ago

I need this while I'm using axonframework with mongodb. Can someone help to add this feature in?

michaelklishin commented 11 years ago

@liougehooa you can contribute a feature you need. That's how open source works.

lordbuddha commented 10 years ago

Am thinking that this should be simpler than suggested by just using an additional lock for the job.

Also updating the insertion of the trigger lock to use FSYNCED (deleting the lock is OK left at JOURNAL_SAFE). This is required to guarantee the lock is 100% effective.

Am currently testing an implementation for this.