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

Consider making @Blocking behave as @ExecuteOn(TaskExecutors.IO) #7239

Open
sdelamo opened this issue Apr 21, 2022 · 2 comments
Open

Consider making @Blocking behave as @ExecuteOn(TaskExecutors.IO) #7239

sdelamo opened this issue Apr 21, 2022 · 2 comments
Labels
status: next major version The issue will be considered for the next major version status: under consideration The issue is being considered, but has not been accepted yet type: breaking Introduces a breaking change
Milestone

Comments

@sdelamo
Copy link
Collaborator

sdelamo commented Apr 21, 2022

Issue description

I think for Micronaut 4.0, if a user adds @Blocking to a method and they are using the Netty runtime the behaviour should be identical as if they use @ExecuteOn(TaskExecutors.IO).

I think @Blocking is a more idiomatic annotation which conveys what the codes does. Then it is up to the runtime to execute it in a different thread pool if applies.

We are already using @Blocking in Micronaut Data CRUD repositories

Currently, @Blocking only works for AUTO thread selection. Since Micronaut 2.0 thread section defaults to manual.

@sdelamo sdelamo added status: under consideration The issue is being considered, but has not been accepted yet status: next major version The issue will be considered for the next major version type: breaking Introduces a breaking change labels Apr 21, 2022
@sdelamo sdelamo added this to the 4.0.0 milestone Apr 21, 2022
@sdelamo
Copy link
Collaborator Author

sdelamo commented Apr 21, 2022

An alternative would be to remove @Blocking as suggested by @jameskleeh. An advantage to remove the annotation would be to have a single way of doing things.

@jameskleeh
Copy link
Contributor

@Blocking requires the user to read the javadoc to know what thread it executes on but @ExecuteOn makes it clear immediately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: next major version The issue will be considered for the next major version status: under consideration The issue is being considered, but has not been accepted yet type: breaking Introduces a breaking change
Projects
None yet
Development

No branches or pull requests

2 participants