@Override public Object handler(final ProceedingJoinPoint point, final HmilyTransactionContext context) throws Throwable { Object returnValue; try { HmilyTransaction hmilyTransaction = hmilyTransactionExecutor.preTry(point); try { //execute try returnValue = point.proceed(); hmilyTransaction.setStatus(HmilyActionEnum.TRYING.getCode()); hmilyTransactionExecutor.updateStatus(hmilyTransaction); } catch (Throwable throwable) { //if exception ,execute cancel final HmilyTransaction currentTransaction = hmilyTransactionExecutor.getCurrentTransaction(); executor.execute(() -> hmilyTransactionExecutor .cancel(currentTransaction)); throw throwable; } //execute confirm final HmilyTransaction currentTransaction = hmilyTransactionExecutor.getCurrentTransaction(); executor.execute(() -> hmilyTransactionExecutor.confirm(currentTransaction)); } finally { HmilyTransactionContextLocal.getInstance().remove(); hmilyTransactionExecutor.remove(); } return returnValue; }
updateStatus(currentTransaction); final List<HmilyParticipant> hmilyParticipants = currentTransaction.getHmilyParticipants(); List<HmilyParticipant> failList = Lists.newArrayListWithCapacity(hmilyParticipants.size());
hmilyTransaction.setStatus(HmilyActionEnum.TRYING.getCode()); hmilyTransactionExecutor.updateStatus(hmilyTransaction); return proceed; } catch (Throwable throwable) {
currentTransaction.setStatus(HmilyActionEnum.CANCELING.getCode()); updateStatus(currentTransaction); for (HmilyParticipant hmilyParticipant : hmilyParticipants) { try {