You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a quick question regarding the implementation of Timeouts
It uses under the hood a java.util.Timer to schedule tasks to trigger timeouts.
After some reasearch I have found out that java.util.Timer could be replaced in most cases by a java.util.concurrent.ScheduledExecutorService as it performs better.
There is a bit of info in the javadoc and an interesting stackoverflow questions.
Therefore I performed the change in one my project that also used this kind of trick to design timeouts to see if it works.
I don't have a proper jmh benchmark to back this up but it does seem to perfom better for my use case.
Anyway, I just wanted to let you know about my research and to get your feedback regarding your choice of going with Timer in first place.
Thank you for the nice lib!
The text was updated successfully, but these errors were encountered:
The way the timer is used here is pretty much what ScheduledExecutorService does. The only logic triggered on it is creating/starting of a Future on the provided execution context, so it does not block the Timer thread, same goes for exceptions in the scheduled code-block, they end up failing the created future, not failing the Timer thread, so the problems described does not really apply as far as I can see. The statement about clock drift could be relevant but I couldn't find more details about Timer behaviour around that with a quick search though.
Hi,
I have a quick question regarding the implementation of Timeouts
It uses under the hood a
java.util.Timer
to schedule tasks to trigger timeouts.After some reasearch I have found out that
java.util.Timer
could be replaced in most cases by ajava.util.concurrent.ScheduledExecutorService
as it performs better.There is a bit of info in the javadoc and an interesting stackoverflow questions.
Therefore I performed the change in one my project that also used this kind of trick to design timeouts to see if it works.
I don't have a proper jmh benchmark to back this up but it does seem to perfom better for my use case.
Anyway, I just wanted to let you know about my research and to get your feedback regarding your choice of going with
Timer
in first place.Thank you for the nice lib!
The text was updated successfully, but these errors were encountered: