Skip to content

Conversation

@simbo1905
Copy link
Owner

Fixes HttpClient resource management in ApiTracker.java by implementing proper try-with-resources pattern for Java 21+ AutoCloseable support.

Changes:

  • Replaced static shared HttpClient instance with factory method
  • Updated fetchFromUrl() and fetchUpstreamSources() to use try-with-resources
  • Ensures proper resource cleanup and prevents potential leaks
  • Aligns with Java 21+ AutoCloseable best practices

Tested: Code compiles and API tracker functionality works correctly.

Closes #58

simbo1905 and others added 4 commits September 27, 2025 08:42
- Replaced static shared HttpClient instance with factory method
- Updated fetchFromUrl() to use try-with-resources for proper resource management
- Updated fetchUpstreamSources() to use try-with-resources for proper resource management
- Ensures HttpClient instances are properly closed after use
- Aligns with Java 21+ AutoCloseable best practices

The changes ensure that HttpClient resources are properly managed using
try-with-resources, preventing potential resource leaks and following
Java best practices for AutoCloseable resources.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Added bullet point under 'Leverage Java 21+ features' section
- Specifies that try-with-resources must be used for all AutoCloseable resources
- Includes examples like HttpClient and streams
- Ensures proper resource management following Java best practices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Updated reference to deleted CODING_STYLE.md file
- Changed to indicate this section contains the coding standards directly
- Added try-with-resources bullet point under Java 21+ features
- Ensures documentation is accurate and complete

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…r comments

- Added bullet point prohibiting advertising/promotional content in commit messages
- Added bullet point prohibiting 'Co-Authored-By' comments in commit messages
- Both guidelines added to Commit Requirements section
- Ensures clean, professional commit messages without external advertising
- Maintains proper git attribution through standard author fields
@simbo1905 simbo1905 merged commit 150e69e into main Sep 27, 2025
4 checks passed
@simbo1905 simbo1905 deleted the fix-issue-58-httpclient-resources branch September 27, 2025 07:51
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.

Fix HttpClient resource management in ApiTracker.java

2 participants