Commit 669aee46a862e3ff14575667b6264911687e82f8
1 parent
8835836f
1、修改TransactionRecovery,每次循环恢复transaction时,propagationExistBegin事务上下文
2、删除target目录的git
Showing
12 changed files
with
14 additions
and
19 deletions
.gitignore
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | .project | 2 | .project |
| 3 | .springBeans | 3 | .springBeans |
| 4 | .settings/* | 4 | .settings/* |
| 5 | -/target/* | 5 | +target/ |
| 6 | node_modules/ | 6 | node_modules/ |
| 7 | test_junitReport/ | 7 | test_junitReport/ |
| 8 | test_coverage/ | 8 | test_coverage/ |
| @@ -12,5 +12,5 @@ test_coverage/ | @@ -12,5 +12,5 @@ test_coverage/ | ||
| 12 | tmp | 12 | tmp |
| 13 | 13 | ||
| 14 | # git忽略空文件夹,按照惯例,空文件夹下放置.gitkeep文件避免文件夹被忽略不上传。 | 14 | # git忽略空文件夹,按照惯例,空文件夹下放置.gitkeep文件避免文件夹被忽略不上传。 |
| 15 | -!.gitkeep | ||
| 16 | -/target/ | 15 | +!.gitkeep |
| 16 | +/target/ |
tcc-transaction-api/target/maven-archiver/pom.properties deleted
100644 → 0
tcc-transaction-api/target/tcc-transaction-api-1.1.5_comment-sources.jar deleted
100644 → 0
No preview for this file type
tcc-transaction-api/target/tcc-transaction-api-1.1.5_comment.jar deleted
100644 → 0
No preview for this file type
tcc-transaction-core/src/main/java/org/mengyun/tcctransaction/recover/TransactionRecovery.java
| @@ -2,7 +2,9 @@ package org.mengyun.tcctransaction.recover; | @@ -2,7 +2,9 @@ package org.mengyun.tcctransaction.recover; | ||
| 2 | 2 | ||
| 3 | import org.mengyun.tcctransaction.Transaction; | 3 | import org.mengyun.tcctransaction.Transaction; |
| 4 | import org.mengyun.tcctransaction.TransactionType; | 4 | import org.mengyun.tcctransaction.TransactionType; |
| 5 | +import org.mengyun.tcctransaction.api.TransactionContext; | ||
| 5 | import org.mengyun.tcctransaction.api.TransactionStatus; | 6 | import org.mengyun.tcctransaction.api.TransactionStatus; |
| 7 | +import org.mengyun.tcctransaction.api.TransactionXid; | ||
| 6 | import org.mengyun.tcctransaction.repository.TransactionRepository; | 8 | import org.mengyun.tcctransaction.repository.TransactionRepository; |
| 7 | import org.mengyun.tcctransaction.support.TransactionConfigurator; | 9 | import org.mengyun.tcctransaction.support.TransactionConfigurator; |
| 8 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| @@ -76,7 +78,6 @@ public class TransactionRecovery { | @@ -76,7 +78,6 @@ public class TransactionRecovery { | ||
| 76 | */ | 78 | */ |
| 77 | private void recoverErrorTransactions(List<Transaction> transactions) { | 79 | private void recoverErrorTransactions(List<Transaction> transactions) { |
| 78 | 80 | ||
| 79 | - | ||
| 80 | for (Transaction transaction : transactions) { | 81 | for (Transaction transaction : transactions) { |
| 81 | 82 | ||
| 82 | if (transaction.getRetriedCount() > transactionConfigurator.getRecoverConfig().getMaxRetryCount()) { | 83 | if (transaction.getRetriedCount() > transactionConfigurator.getRecoverConfig().getMaxRetryCount()) { |
| @@ -90,6 +91,15 @@ public class TransactionRecovery { | @@ -90,6 +91,15 @@ public class TransactionRecovery { | ||
| 90 | try { | 91 | try { |
| 91 | transaction.addRetriedCount(); // 重试次数+1 | 92 | transaction.addRetriedCount(); // 重试次数+1 |
| 92 | 93 | ||
| 94 | + // 传播需要恢复的事务上下文 | ||
| 95 | + TransactionContext transactionContext = new TransactionContext( | ||
| 96 | + new TransactionXid( | ||
| 97 | + transaction.getXid().getGlobalTransactionId(), | ||
| 98 | + transaction.getXid().getBranchQualifier()), | ||
| 99 | + transaction.getStatus().getId() | ||
| 100 | + ); | ||
| 101 | + transactionConfigurator.getTransactionManager().propagationExistBegin(transactionContext); | ||
| 102 | + | ||
| 93 | if (transaction.getStatus().equals(TransactionStatus.CONFIRMING)) { | 103 | if (transaction.getStatus().equals(TransactionStatus.CONFIRMING)) { |
| 94 | // 如果是CONFIRMING(2)状态,则将事务往前执行 | 104 | // 如果是CONFIRMING(2)状态,则将事务往前执行 |
| 95 | transaction.changeStatus(TransactionStatus.CONFIRMING); | 105 | transaction.changeStatus(TransactionStatus.CONFIRMING); |
tcc-transaction-core/target/classes/org/mengyun/tcctransaction/recover/TransactionRecovery.class
No preview for this file type
tcc-transaction-core/target/maven-archiver/pom.properties deleted
100644 → 0
tcc-transaction-core/target/tcc-transaction-core-1.1.5_comment-sources.jar deleted
100644 → 0
No preview for this file type
tcc-transaction-core/target/tcc-transaction-core-1.1.5_comment.jar deleted
100644 → 0
No preview for this file type
tcc-transaction-spring/target/maven-archiver/pom.properties deleted
100644 → 0
tcc-transaction-spring/target/tcc-transaction-spring-1.1.5_comment-sources.jar deleted
100644 → 0
No preview for this file type
tcc-transaction-spring/target/tcc-transaction-spring-1.1.5_comment.jar deleted
100644 → 0
No preview for this file type