Merge pull request #13 from ChaosCoffee/master

解决嵌套事务里事务组group Id传递问题
This commit is contained in:
纳兰丶 2018-06-11 17:49:58 +08:00 committed by GitHub
commit e1748df08d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,7 @@ import com.raincat.common.bean.TxTransactionInfo;
import com.raincat.core.compensation.command.TxCompensationCommand;
import com.raincat.core.concurrent.task.BlockTask;
import com.raincat.core.concurrent.task.BlockTaskHelper;
import com.raincat.core.concurrent.threadlocal.TxTransactionLocal;
import com.raincat.core.concurrent.threadpool.TransactionThreadPool;
import com.raincat.core.service.TxManagerMessageService;
import com.raincat.core.service.TxTransactionHandler;
@ -77,10 +78,12 @@ public class ActorTxTransactionHandler implements TxTransactionHandler {
LogUtil.info(LOGGER, "分布式事务参与方,开始执行,事务组id{}", info::getTxGroupId);
final String taskKey = IdWorkerUtils.getInstance().createTaskKey();
final BlockTask task = BlockTaskHelper.getInstance().getTask(taskKey);
TxTransactionLocal.getInstance().setTxGroupId(info.getTxGroupId());
transactionThreadPool
.newFixedThreadPool()
.execute(() -> {
TxTransactionLocal.getInstance().setTxGroupId(info.getTxGroupId());
final String waitKey = IdWorkerUtils.getInstance().createTaskKey();
final BlockTask waitTask = BlockTaskHelper.getInstance().getTask(waitKey);
DefaultTransactionDefinition def = new DefaultTransactionDefinition();