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

[JENKINS-68071] Java 17 compat: make CpsThreadGroup.paused transient to avoid XStreaming AtomicBoolean #515

Merged
merged 1 commit into from
Mar 18, 2022

Conversation

jglick
Copy link
Member

@jglick jglick commented Mar 18, 2022

https://issues.jenkins.io/browse/JENKINS-68071

Amends #32. Relevant test coverage is in CpsFlowExecutionTest. Fixes the Java 17 run of

mvn test -Dtest=org.jenkinsci.plugins.workflow.cps.CpsThreadDumpActionTest\#doProgramDotXml -Djenkins.version=2.339 -Djenkins-test-harness.version=1721.v385389722736 '-DargLine=--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED'

printing as expected

<executionPaused>false</executionPaused>

@jglick jglick added the bug label Mar 18, 2022
@jglick jglick requested review from dwnusbaum, basil and car-roll March 18, 2022 15:55
/**
* Persistent version of {@link #paused}.
*/
private boolean executionPaused;
Copy link
Member

Choose a reason for hiding this comment

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

Might not hurt to make this volatile? No strong preference.

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe make it Boolean and only set it to a non-null value in writeReplace (and null it out in readResolve).

Copy link
Member Author

Choose a reason for hiding this comment

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

No need for volatile since it is not read except during deserialization.

Considered setting it during writeReplace but seemed like overkill since it is only ever written in two places and it just as easy to set it then.

/**
* Persistent version of {@link #paused}.
*/
private boolean executionPaused;
Copy link
Member

Choose a reason for hiding this comment

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

Or maybe make it Boolean and only set it to a non-null value in writeReplace (and null it out in readResolve).

@jglick jglick changed the title [JENKINS-68071] Make CpsThreadGroup.paused transient to avoid XStreaming AtomicBoolean [JENKINS-68071] Java 17 compat: make CpsThreadGroup.paused transient to avoid XStreaming AtomicBoolean Mar 18, 2022
@jglick jglick enabled auto-merge March 18, 2022 17:50
@jglick jglick merged commit f642ed4 into jenkinsci:master Mar 18, 2022
@jglick jglick deleted the CpsThreadGroup.paused-JENKINS-68071 branch March 18, 2022 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants