Repository navigation
[WFLY-20988] Followup improvements of Jakarta EE 11 JPA / CDI integration for WildFly Preview - #19232
Conversation
…ion for WildFly Preview Signed-off-by: Scott Marlow <[email protected]>
| weldCapability.get().registerExtensionInstance(persistenceCdiExtension, deploymentUnit); | ||
| else { | ||
| // ensure that other threads use the service that was loaded in a different thread. | ||
| persistenceCdiExtension = deploymentUnit.getAttachment(JpaAttachments.AFTER_BEAN_DISCOVERY_ATTACHMENT_KEY); |
There was a problem hiding this comment.
This change ensures that the other threads register the persistence units with the persistenceCdiExtension (service) actually registered as a CDI extension (e.g. via the weldCapability.get().registerExtensionInstance(persistenceCdiExtension, deploymentUnit) call in a different thread)
There was a problem hiding this comment.
Sorry, it doesn't look like I finished my review on this.
This still is quite correct. When you have time to discuss it, ping me in chat. I need to understand better. If concurrency is a concern we need have some kind of shared lock per-deployment. I'm not sure that concurrency is a concern here though as I see other places in the source which don't seem concerned about it.
There was a problem hiding this comment.
For reference the previous feedback was:
The issue though is that if deploymentUnit.putAttachment(JpaAttachments.AFTER_BEAN_DISCOVERY_ATTACHMENT_KEY, persistenceCdiExtension) returns a value, you'd be executing the register() on the wrong instance.
Yes, I see it now! Originally, we had a synchronize on the top level deployment unit (e.g. ear, standalone war, standalone jar):
synchronized (deploymentUnit) { // protect against multiple subdeployment threads registering the persistenceCdiExtension at same time
We could use a different object to lock on than the (top most level) DeploymentUnit but yes having a shared lock per (top level) deployment is the right idea.
…tence unit deployments don't get a NPE which likely would of happened eventually Signed-off-by: Scott Marlow <[email protected]>
| // @Message(id = 80, value = "Found more than one %s service for application deployment %s") | ||
| // RuntimeException foundMoreThanOneCdiExtensionService(Class<?> serviceClassName, ClassLoader module); |
There was a problem hiding this comment.
In this specific case we can actually delete this since it has never been in a final release.
Signed-off-by: Scott Marlow <[email protected]>
3514dc3 to
9f951ea
Compare
|
@jamezp @scottmarlow I removed the ready-for-merge label for this because yesterday I ran two other WFP+JPA PRs in a combo PR against the EE 11 branch, and this wasn't part of it, since it wasn't approved. Those tests passed. So I'll merge those two and then get more testing of this to ensure the combo isn't a problem |
|
Ah, sorry. I should have thought about kicking off an EE11 job. |
|
That's ok; I'm mostly wanting to be sure the combo of the 3 related PRs is ok. I'll do that job now. |
|
Thanks @scottmarlow and @jamezp |
https://issues.redhat.com/browse/WFLY-20988