-
Notifications
You must be signed in to change notification settings - Fork 519
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
GH-388: add non blocking sleeper #440
GH-388: add non blocking sleeper #440
Conversation
hakimrabet
commented
May 23, 2024
- fix 388 (default implementation of @Backoff() should not use Thread.sleep #388)
- add non blocking sleeper
@hakimrabet Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@hakimrabet Thank you for signing the Contributor License Agreement! |
- fix (spring-projects#388) - add non blocking sleeper
49762a6
to
6b07318
Compare
- fix (spring-projects#388) - add non blocking sleeper
- fix (spring-projects#388) - add non blocking sleeper
throw new BackOffInterruptedException("Thread interrupted while sleeping", e); | ||
} | ||
}); | ||
future.join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry what difference does it make against regular Thread.sleep()
in the thread which calls this Sleeper
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for reading and comment my code.
when backoff execute from a scheduler and the thread that run the scheduler, going to sleep in the (sleeper.java).
the main idea of that is to release the thread that run scheduler, because the time scheduler and back off time going to Disorder the scheduler or preventing other scheduler from running.
am i right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a confirmation with tests that it works as you explain ?
I just believe that this join()
is blocking the thread which calls it.
throw new BackOffInterruptedException("Thread interrupted while sleeping", e); | ||
} | ||
}); | ||
future.join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a confirmation with tests that it works as you explain ?
I just believe that this join()
is blocking the thread which calls it.
i dig more about it, indeed you're right. join() block the thread as like Thread.Sleep(). |