Skip to content

fix(QTDI-1638): thread safe component manager #1053

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ozhelezniak-talend
Copy link
Contributor

@ozhelezniak-talend ozhelezniak-talend commented Jun 5, 2025

Requirements

  • Any code change adding any logic MUST be tested through a unit test executed with the default build
  • Any API addition MUST be done with a documentation update if relevant

Why this PR is needed?

https://qlik-dev.atlassian.net/browse/QTDI-1638

What does this PR adds (design/code thoughts)?

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces thread safety improvements for the component manager while also refactoring some stream operations and enhancing the multithreaded test coverage. Key changes include:

  • Replacing lambda expressions with method references and refactoring stream operations for clarity.
  • Introducing a ReentrantReadWriteLock to protect shared state in the ComponentManager.
  • Adding unit tests for multithreaded auto-discovery of plugins.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java Refactored stream operations using method references and String.join for clarity.
component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/asm/PluginGenerator.java Added proper closing of JAR entries and introduced a dependencies file entry.
component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/ComponentManagerTest.java Introduced multithreaded tests for plugin auto-discovery with added parameterized testing.
component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java Implemented thread safety via ReentrantReadWriteLock in multiple methods and adjusted API calls accordingly.
Comments suppressed due to low confidence (1)

component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/asm/PluginGenerator.java:110

  • The error message contains a spelling mistake ('occured' should be 'occurred').
outputStream.write(("error=An error occured").getBytes(StandardCharsets.UTF_8));

This comment has been minimized.

This comment has been minimized.

Copy link

sonar-eks bot commented Jun 5, 2025

Passed

Analysis Details

1 Issue

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 1 Code Smell

Coverage and Duplications

  • Coverage 98.40% Coverage (56.50% Estimated after merge)
  • Duplications 0.00% Duplicated Code (1.30% Estimated after merge)

Project ID: org.talend.sdk.component:component-runtime

View in SonarQube

@ozhelezniak-talend ozhelezniak-talend requested a review from undx June 6, 2025 08:10
Copy link
Member

@undx undx left a comment

Choose a reason for hiding this comment

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

lgtm

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.

2 participants