-
Notifications
You must be signed in to change notification settings - Fork 147
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
Fixes issue #24849 make relevant methods synchronized in LocalTxConnectionEventListener #24851
Conversation
…LocalTxConnectionEventListener and protect associatedHandles from external clear calls. Fixes issue eclipse-ee4j#24849 make relevant methods synchronized in LocalTxConnectionEventListener and protect associatedHandles from external clear calls.
...ectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/ConnectorXAResource.java
Outdated
Show resolved
Hide resolved
...ectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/ConnectorXAResource.java
Show resolved
Hide resolved
LocalTxConnectionEventListener and protect associatedHandles from external clear calls. Process review comment and fix typo.
...ntime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java
Outdated
Show resolved
Hide resolved
...ntime/src/main/java/com/sun/enterprise/resource/listener/LocalTxConnectionEventListener.java
Outdated
Show resolved
Hide resolved
Also, because |
I cannot oversee the impact of using ReentrantReadWriteLock on only the associatedHandles. Some code like the To know for sure I think I need to have found the real cause of issue #24805 and probably also of issue #23483 which I think could be related and run my test set many times. where I suspect resourceHandles can get mixed up, and could perhaps cause this issue as side effect. |
LocalTxConnectionEventListener and protect associatedHandles from external clear calls. Process review comment: use getOrDefault.
Make relevant methods synchronized in LocalTxConnectionEventListener and protect associatedHandles from external clear calls.
I first tried to move most of the ConnectorXAResource.resetAssociation method inside a synchronous method in the LocalTxConnectionEventListener, but that also meant two other methods from ConnectorXAResource needed to be refactored and moved into LocalTxConnectionEventListener. So I undid that and chose for cloning the map and returning a clone to make the method getAssociatedHandles thread safe. This is a different solution as used in the Payara fix I mention in the issue. But I think it is better to leave the association and disassociating of ManagedConnection logic inside the ConnectorXAResource code.
I did not add multi threading unit tests, since only the basic synchronized(this) approach is used to protect the associatedHandles map. No need to test java. I did add some basic unit test logic for the add and remove logic used by ConnectorXAResource.