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

Add support for java.util.function.Supplier timing to Timer #566

Closed
osi opened this issue May 30, 2018 · 2 comments · Fixed by #1086
Closed

Add support for java.util.function.Supplier timing to Timer #566

osi opened this issue May 30, 2018 · 2 comments · Fixed by #1086
Milestone

Comments

@osi
Copy link
Contributor

osi commented May 30, 2018

Similar to how the Callable helper works, add one for Supplier. It is beneficial because Callable throws a checked exception which limits where it can be used (eg, in a Stream pipeline)

@brharrington
Copy link
Contributor

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.

@brharrington brharrington added this to the backlog milestone May 30, 2018
@osi
Copy link
Contributor Author

osi commented May 30, 2018

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 brharrington modified the milestones: backlog, 1.7.0 Oct 20, 2023
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants