Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Quarkus Scheduler to handle concurrent execution #10203

Closed
pcasaes opened this issue Jun 23, 2020 · 8 comments · Fixed by #10338
Closed

Allow Quarkus Scheduler to handle concurrent execution #10203

pcasaes opened this issue Jun 23, 2020 · 8 comments · Fixed by #10338
Assignees
Labels
Milestone

Comments

@pcasaes
Copy link
Contributor

pcasaes commented Jun 23, 2020

Description
According to the docs Quarkus Scheduler allows concurrent execution

https://quarkus.io/guides/scheduler

The invocation of the scheduled method does not depend on the status or result of the previous invocation.

It would be nice to be able to prevent concurrent execution.

Implementation ideas

We can add a property to the Scheduled annotation that would control this. It would default to the concurrent behavior of course.

@pcasaes pcasaes added the kind/enhancement New feature or request label Jun 23, 2020
@gsmet
Copy link
Member

gsmet commented Jun 24, 2020

/cc @mkouba

@mkouba mkouba self-assigned this Jun 25, 2020
@mkouba
Copy link
Contributor

mkouba commented Jun 25, 2020

Sounds reasonable. We could add concurrentExecution() default true to @Scheduled. For simple scheduler we'll add a mutable flag to the trigger. For Quartz this would be mapped to a job class annotated with org.quartz.DisallowConcurrentExecution.

@mkouba
Copy link
Contributor

mkouba commented Jun 25, 2020

I've finished the implementation but I'm still struggling to write a proper test.

@mkouba
Copy link
Contributor

mkouba commented Jun 25, 2020

Hm, actually the contract of @DisallowConcurrentExecution is a bit different compared to what I would expect. The job execution is not skipped but delayed until the previous job finished. That's a bit more complex to implement. We need to think about it...

@McIntozh
Copy link

Hi,
I postet a simmilar request some days ago, where, in a possible workaround, I received the wanted behaviour by adding the synchronized modifier to the scheduled method: #9883

@mkouba
Copy link
Contributor

mkouba commented Jun 29, 2020

I've created a draft PR here: #10338

@gastaldi gastaldi linked a pull request Jun 29, 2020 that will close this issue
@mkouba
Copy link
Contributor

mkouba commented Jul 1, 2020

@pcasaes @McIntozh does the aforementioned PR fix your problem?

@pcasaes
Copy link
Contributor Author

pcasaes commented Jul 1, 2020

Being able to SKIP is very much what I was looking for. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants