Skip to content

Commit

Permalink
optimize: add tcc fence hook function (apache#6731)
Browse files Browse the repository at this point in the history
  • Loading branch information
chengliefeng committed Aug 19, 2024
1 parent 6d744ee commit dc0f4e0
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,6 @@ public Object prepareFence(String xid, Long branchId, String actionName, Callbac
});
}

/**
* This method executes a Runnable with transaction context and logs any exceptions that occur without allowing them to propagate.
* @param runnable the runnable
* @param xid the global transaction id
* @param branchId the branch transaction id
* @param methodName the runnable name
*/
private void executeWithHandling(Runnable runnable, String xid, Long branchId, String methodName) {
try {
runnable.run();
} catch (Exception e) {
LOGGER.warn("Tcc fence Exception in {}, xid: {}, branchId: {}", methodName, xid, branchId, e);
}
}

/**
* common commit method enhanced
*
Expand Down Expand Up @@ -402,6 +387,21 @@ public void run() {
}
}

/**
* This method executes a Runnable with transaction context and logs any exceptions that occur without allowing them to propagate.
* @param runnable the runnable
* @param xid the global transaction id
* @param branchId the branch transaction id
* @param methodName the runnable name
*/
private void executeWithHandling(Runnable runnable, String xid, Long branchId, String methodName) {
try {
runnable.run();
} catch (Exception e) {
LOGGER.warn("Tcc fence Exception in {}, xid: {}, branchId: {}", methodName, xid, branchId, e);
}
}

private static class FenceLogIdentity {
/**
* the global transaction id
Expand Down

0 comments on commit dc0f4e0

Please sign in to comment.