Skip to content

Conversation

@Pankraz76
Copy link
Contributor

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] SUMMARY,
    where you replace MNG-XXX and SUMMARY with the appropriate JIRA issue.
  • Also format the first line of the commit message like [MNG-XXX] SUMMARY.
    Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@Pankraz76 Pankraz76 changed the title extract dedicated class CheckThreadSafetyThread from CheckThreadSafetyMojo for concern checkThreadSafety dedicate class CheckThreadSafetyThread from CheckThreadSafetyMojo for concern checkThreadSafety May 23, 2025
Pankraz76 pushed a commit to Pankraz76/maven that referenced this pull request May 23, 2025
@Pankraz76 Pankraz76 force-pushed the CheckThreadSafetyThread-CountDownLatch-EmptyControlStatement-CheckThreadSafetyMojo branch from 0d52b22 to d933562 Compare May 23, 2025 07:26
final CountDownLatch startLatch = new CountDownLatch(1);
final Thread[] threads = new Thread[2];
for (int i = 0; i < threads.length; i++) {
// NOTE: The threads need to use different realms to trigger changes of the collections
Copy link
Contributor Author

Choose a reason for hiding this comment

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

might be candidate for @implNote to give special attention, thus higher scope.

private final ClassLoader tccl = cl;

public void run() {
getLog().info("[MAVEN-CORE-IT-LOG] Thread " + this + " uses " + tccl);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this comes from the logger normally, right? its kind of dry:

image

for (int i = 0; i < threads.length; i++) {
// NOTE: The threads need to use different realms to trigger changes of the collections
final ClassLoader cl = (i % 2) == 0 ? pluginRealm : coreRealm;
threads[i] = new Thread() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why no runnable? we only implement run method so this is kind of funny.

Pankraz76 pushed a commit to Pankraz76/maven that referenced this pull request May 23, 2025
@Pankraz76 Pankraz76 force-pushed the CheckThreadSafetyThread-CountDownLatch-EmptyControlStatement-CheckThreadSafetyMojo branch from d933562 to 101e65a Compare May 23, 2025 07:45
Pankraz76 pushed a commit to Pankraz76/maven that referenced this pull request May 23, 2025
@Pankraz76 Pankraz76 force-pushed the CheckThreadSafetyThread-CountDownLatch-EmptyControlStatement-CheckThreadSafetyMojo branch from 101e65a to f28aed5 Compare May 23, 2025 07:45
*
* @implNote threads need to use different realms to trigger changes of the collections.
*/
public void execute() throws MojoExecutionException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

require test coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test for test seems strange.

Pankraz76 pushed a commit to Pankraz76/maven that referenced this pull request May 23, 2025
@Pankraz76 Pankraz76 force-pushed the CheckThreadSafetyThread-CountDownLatch-EmptyControlStatement-CheckThreadSafetyMojo branch from f28aed5 to 1eac488 Compare May 23, 2025 09:26
@Pankraz76
Copy link
Contributor Author

wip

@Pankraz76 Pankraz76 closed this May 23, 2025
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.

1 participant