Skip to content

Conversation

@sergiyvamz
Copy link
Contributor

@sergiyvamz sergiyvamz commented Mar 17, 2025

Summary

Use ExecutorService to manage node monitoring threads
#1321

Additional Reviewers

@karenc-bq

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergiyvamz sergiyvamz added the wip Pull request that is a work in progress label Mar 17, 2025
@github-actions
Copy link

github-actions bot commented Mar 17, 2025

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@sergiyvamz sergiyvamz force-pushed the fix-issue-1321-thread-leaks branch 2 times, most recently from 0efa17b to 89f7453 Compare March 17, 2025 22:02
@sergiyvamz sergiyvamz changed the title [WIP] prevent threads leaking prevent threads leaking Mar 18, 2025
@sergiyvamz sergiyvamz removed the wip Pull request that is a work in progress label Mar 18, 2025
this.nodeExecutorService.shutdownNow();
}
} catch (InterruptedException e) {
// do nothing
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to call this.nodeExecutorService.shutdownNow(); here if the awaitTemrmination request is interrupted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's another final block in run() method that can catch InterruptedException and handle it.

@sergiyvamz sergiyvamz force-pushed the fix-issue-1321-thread-leaks branch from 89f7453 to 88f3120 Compare March 18, 2025 00:39
@sergiyvamz sergiyvamz enabled auto-merge (squash) March 18, 2025 00:40
@sergiyvamz sergiyvamz force-pushed the fix-issue-1321-thread-leaks branch from 88f3120 to 7df7774 Compare March 18, 2025 01:24
@sergiyvamz sergiyvamz force-pushed the fix-issue-1321-thread-leaks branch from 7df7774 to 9533dae Compare March 18, 2025 15:18
@sergiyvamz sergiyvamz merged commit 1e12a7b into main Mar 18, 2025
6 checks passed
@sergiyvamz sergiyvamz deleted the fix-issue-1321-thread-leaks branch March 18, 2025 16:10
this.stop.set(true);
this.shutdownNodeExecutorService();

final Connection conn = this.monitoringConnection.get();

Choose a reason for hiding this comment

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

@sergiyvamz would it be better to use getAndSet ? in a few places you are splitting get and set on atomic in this class...

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