lightClouds917 commented on code in PR #7073:
URL: https://github.com/apache/incubator-seata/pull/7073#discussion_r1903400086
##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java:
##########
@@ -127,10 +130,12 @@ private void xaEnd(XAXid xaXid, int flags) throws
XAException {
* @param applicationData application data
* @throws SQLException SQLException
*/
- public synchronized void xaCommit(String xid, long branchId, String
applicationData) throws XAException {
- XAXid xaXid = XAXidBuilder.build(xid, branchId);
- xaResource.commit(xaXid, false);
- releaseIfNecessary();
+ public void xaCommit(String xid, long branchId, String applicationData)
throws XAException {
Review Comment:
> Is there a more elegant way to write code? resourceLock.obtain() is more
complex than the synchronized keyword.
The reason i write this way is to avoid having to add unlock to finally;
`java
class X {
private final ReentrantLock lock = new ReentrantLock();
public void m() {
lock.lock(); // block until condition holds
try {
// ... method body
} finally {
lock.unlock();//unlock
}
}
}
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]