Skip to content

Conversation

ngocnhan-tran1996
Copy link
Contributor

Related to: #10083

@ngocnhan-tran1996 ngocnhan-tran1996 changed the title GH-10083: Apply Nullability to core leader, message and resource packages GH-10083: Apply Nullability to core events, leader, message and resource packages Aug 16, 2025
Related to: spring-projects#10083

This commit applies Nullability to core `events`, `leader`, `leader.event`, `message` and `resource` packages

Signed-off-by: Tran Ngoc Nhan <[email protected]>
@ngocnhan-tran1996 ngocnhan-tran1996 force-pushed the gh-10083-core-module-packages branch from 6abb470 to 6a91a4a Compare August 16, 2025 05:47
private volatile ResourcePatternResolver patternResolver;

private volatile CollectionFilter<Resource> filter;
private volatile @Nullable CollectionFilter<Resource> filter;
Copy link
Member

Choose a reason for hiding this comment

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

... and remove volatile on all the properties.
It is really an anti-pattern to change state of the component at runtime.
Therefore, we treat all of them as state fixed after initialization phase.
Therefore, no need in extra ticks over volatile barrier.

}
}
else {
inputMessage = MessageBuilder.withPayload(new byte[0]).build();
Copy link
Member

Choose a reason for hiding this comment

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

I think it is better to throw an exception instead.
How that happened that AdviceMessage was serialized without an inputMessage?
So, the state is illegal.
WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I wasn’t sure about the behavior in this case, so I decided to initialize the value.

@artembilan artembilan enabled auto-merge (squash) August 18, 2025 18:41
@artembilan artembilan disabled auto-merge August 18, 2025 18:57
@ngocnhan-tran1996
Copy link
Contributor Author

Can we re-run the build? I haven’t touched the related context package.

@artembilan artembilan merged commit 10d4867 into spring-projects:main Aug 18, 2025
2 of 3 checks passed
@artembilan
Copy link
Member

I haven’t touched the related context package.

I know.
That looks like Gradle build cache hallucination.
We made a change in the core module, and therefore all others have to be rebuild.
But apparently we got an ip one from cache before, so it didn't fail for a couple days.
Now, it looks like something else has triggered cache invalidation, so we are failing.
The fix for core is in, therefore I have just merged your PR.

Thank you!

@ngocnhan-tran1996 ngocnhan-tran1996 deleted the gh-10083-core-module-packages branch August 19, 2025 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants