Skip to content

Remove try with resource for Worfklow Worker Examples and use latest changes from durabletask-java #1337

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

Closed

Conversation

siri-varma
Copy link
Contributor

Description

Please explain the changes you've made

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@siri-varma siri-varma requested review from a team as code owners May 7, 2025 19:50
@siri-varma siri-varma force-pushed the users/svegiraju/sdk-update-3 branch from 69817e0 to 1ae4fcb Compare May 7, 2025 19:51
@siri-varma
Copy link
Contributor Author

siri-varma commented May 7, 2025

@cicoyle @salaboy @artur-ciocanu Can you folks please review this PR ?

this is to incorporate the durabletask-java changes. Build will pass once we incorporate the new release.

JoshVanL
JoshVanL previously approved these changes May 7, 2025
@siri-varma siri-varma changed the title Remove AutoCloseable for WorfklowRuntime and use latest changes from durabletask-java Remove AutoCloseable for Worfklow Examples and use latest changes from durabletask-java May 7, 2025
cicoyle
cicoyle previously approved these changes May 7, 2025
Copy link
Contributor

@cicoyle cicoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding the ternary and the followup here 👍🏻 lgtm. just need to wait for the dapr/durabletask-java release to show up in maven central and let CI run green then we can merge

@artur-ciocanu
Copy link
Contributor

@siri-varma and @cicoyle I really the like the idea of being able to provide an ExecutorService to GRPC worker, but I am not following why we need to get rid of AutoClosable.

@siri-varma could you please provide a little bit more details. Thank you.

artur-ciocanu
artur-ciocanu previously approved these changes May 8, 2025
Copy link
Contributor

@artur-ciocanu artur-ciocanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siri-varma LGTM, I get it why we need ExecutorService changes, but I am not following why we need to remove AutoClosable

this.executorService.shutdownNow();
}
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a new line

@siri-varma
Copy link
Contributor Author

siri-varma commented May 8, 2025

@artur-ciocanu The durabletask-java SDK does not manage the gRPC channel when one is externally supplied. In our case, since the java-sdk provides the channel, we are responsible for managing its lifecycle.

So the try with resource was a no op today. To fix that, I’ve added close() and shutdown() methods in WorkflowRuntime to ensure proper cleanup.

As a result, in case of workers, since the gRPC server needs to run continuously, we cannot use try-with-resources — doing so would automatically invoke close(), which would prematurely shut down the server.


Also, the AutoCloseable is still used in the WorkflowRuntime. I just removed the try with resource from the Worker examples because of the above reason.

@siri-varma siri-varma changed the title Remove AutoCloseable for Worfklow Examples and use latest changes from durabletask-java Remove try with resource for Worfklow Worker Examples and use latest changes from durabletask-java May 8, 2025
@siri-varma
Copy link
Contributor Author

@cicoyle I will pull in your changes once they are merged.

@siri-varma siri-varma dismissed stale reviews from artur-ciocanu and cicoyle via 05214c3 May 8, 2025 16:14
@siri-varma siri-varma force-pushed the users/svegiraju/sdk-update-3 branch from 05214c3 to eda5253 Compare May 8, 2025 17:54
@siri-varma
Copy link
Contributor Author

Closing this. All the commits wen in this PR #1336

@siri-varma siri-varma closed this May 8, 2025
Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.28%. Comparing base (d759c53) to head (eda5253).
Report is 139 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1337      +/-   ##
============================================
+ Coverage     76.91%   77.28%   +0.36%     
- Complexity     1592     1765     +173     
============================================
  Files           145      204      +59     
  Lines          4843     5388     +545     
  Branches        562      590      +28     
============================================
+ Hits           3725     4164     +439     
- Misses          821      908      +87     
- Partials        297      316      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants