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

Use try-with-resources to close BatchHandler #15661

Merged
merged 18 commits into from
Nov 15, 2023

Conversation

jason-p-pickering
Copy link
Contributor

@jason-p-pickering jason-p-pickering commented Nov 13, 2023

This is a continuation of https://dhis2.atlassian.net/browse/DHIS2-15362 which seemed not to fully solve the issue with leaked DB connections. BatchHanlder from the quick package is now AutoCloseable and can thus be used in a try-with-resources block. This should help to ensure that all DB connections are completely closed.

@jason-p-pickering jason-p-pickering marked this pull request as draft November 13, 2023 09:33
@jason-p-pickering jason-p-pickering marked this pull request as ready for review November 14, 2023 14:16
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #15661 (3b790d5) into master (ebae39f) will increase coverage by 16.28%.
Report is 6 commits behind head on master.
The diff coverage is 86.36%.

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #15661       +/-   ##
=============================================
+ Coverage     49.92%   66.21%   +16.28%     
- Complexity    23372    31276     +7904     
=============================================
  Files          3483     3483               
  Lines        129910   129911        +1     
  Branches      15181    15181               
=============================================
+ Hits          64864    86022    +21158     
+ Misses        58984    36802    -22182     
- Partials       6062     7087     +1025     
Flag Coverage Δ
integration 49.92% <77.27%> (-0.01%) ⬇️
integration-h2 32.31% <31.81%> (?)
unit 30.28% <86.36%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../dxf2/datavalueset/DefaultDataValueSetService.java 70.54% <100.00%> (+1.20%) ⬆️
...ultCompleteDataSetRegistrationExchangeService.java 43.98% <66.66%> (+43.10%) ⬆️
...tics/table/JdbcOwnershipAnalyticsTableManager.java 94.02% <85.71%> (+0.27%) ⬆️

... and 1269 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a70cf2...3b790d5. Read the comment docs.

Copy link

sonarcloud bot commented Nov 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@jason-p-pickering jason-p-pickering merged commit 928fd9c into master Nov 15, 2023
18 checks passed
@jason-p-pickering jason-p-pickering deleted the batchhandler-autoclose branch November 15, 2023 12:46
jason-p-pickering added a commit that referenced this pull request Nov 15, 2023
* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager
jason-p-pickering added a commit that referenced this pull request Nov 15, 2023
* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager
jason-p-pickering added a commit that referenced this pull request Nov 16, 2023
* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager
jason-p-pickering added a commit that referenced this pull request Nov 16, 2023
* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager
jason-p-pickering added a commit that referenced this pull request Nov 16, 2023
* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager
jason-p-pickering added a commit that referenced this pull request Nov 16, 2023
* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager
jason-p-pickering added a commit that referenced this pull request Nov 16, 2023
* fix: always flush the batch handler for CompleteDataSet import [DHIS2-15362] (2.39) (#15625)

* fix: always flush the batch handler for CompleteDataSet import [DHIS2-15362]

* fix: test setup

* fix: controller imports use interface not impl

* Use try-with-resources to close BatchHandler (#15661) (#15704)

* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager

---------

Co-authored-by: Jan Bernitt <[email protected]>
jason-p-pickering added a commit that referenced this pull request Nov 16, 2023
* fix: always flush the batch handler for CompleteDataSet import [DHIS2-15362] (2.39) (#15625) (#15710)

* fix: always flush the batch handler for CompleteDataSet import [DHIS2-15362]

* fix: test setup

* fix: controller imports use interface not impl

* Use try-with-resources to close BatchHandler (#15661) (#15704) (#15711)

* Use try-with-resources to close BatchHandler

* Rework test to deal with multi-threading

* Add try-catch to Analytics table manager

---------

Co-authored-by: Jan Bernitt <[email protected]>
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.

3 participants