-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add support for java.util.function.Supplier timing to Timer #566
Labels
Milestone
Comments
I'm open to it, but need to think of an appropriate name. One thing we currently regret is having two overloads for record, one that takes Runnable and one that takes Callable. Overloads and lambda don't work that well together. Not sure when I'll get to it, feel free to submit a PR. |
no worries - i'll keep all that in mind! |
brharrington
added a commit
to brharrington/spectator
that referenced
this issue
Oct 20, 2023
Adds methods to the Timer interface to make it easier to work with the Supplier types in the JDK. There is already a method that works with Callable, but since that throws Exception it can be cumbersome to use in code. Methods have also been added for the suppliers with primitive types to avoid boxing. Overload resolution can be messy with lambdas. To avoid those issues record methods have been added with a different name for each interface. The existing record methods for Callable and Runnable have been deprecated in favor of the more specifically named method. Fixes Netflix#566.
brharrington
added a commit
that referenced
this issue
Oct 25, 2023
Adds methods to the Timer interface to make it easier to work with the Supplier types in the JDK. There is already a method that works with Callable, but since that throws Exception it can be cumbersome to use in code. Methods have also been added for the suppliers with primitive types to avoid boxing. Overload resolution can be messy with lambdas. To avoid those issues record methods have been added with a different name for each interface. The existing record methods for Callable and Runnable have been deprecated in favor of the more specifically named method. Fixes #566.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Similar to how the
Callable
helper works, add one forSupplier
. It is beneficial becauseCallable
throws a checked exception which limits where it can be used (eg, in aStream
pipeline)The text was updated successfully, but these errors were encountered: