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

Always stop timers when exiting the 'Timer.time' block #374

Merged
merged 2 commits into from
Jun 11, 2024
Merged

Conversation

kjrokos
Copy link
Contributor

@kjrokos kjrokos commented Jun 11, 2024

Previously, throwing an exception inside the Timer.time() function block would cause the running timer to continue outside of the block.

This change does two things:

  • When the block exits for any reason, the timer will stop
  • Adds a @Throws annotation to the function block so Java code calling this method is also allowed to throw checked exceptions. Previously Java code could only throw unchecked exceptions, while Kotlin code was able to throw any exception. This brings the functionality closer to parity.

Resolves #361

@kjrokos kjrokos self-assigned this Jun 11, 2024
@TrueFiskibility
Copy link
Contributor

Looks good. Note that Java code was always able to throw unchecked exceptions, but it wasn't able to throw checked exceptions. I suppose the choice to allow checked exceptions is a matter of design; I have no opinion on it.

@kjrokos kjrokos merged commit 1e30d85 into main Jun 11, 2024
17 checks passed
@kjrokos kjrokos deleted the fix/361 branch June 11, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

com.vmware.aria.operations.time should stop the timer even if fn throws
4 participants