You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
636 B
32 lines
636 B
package com.soa.microservice.core;
|
|
|
|
/**
|
|
* 事务参与者接口
|
|
* 定义两阶段提交中的参与者行为
|
|
*/
|
|
public interface TransactionParticipant {
|
|
/**
|
|
* 准备阶段
|
|
* @param transactionId 事务ID
|
|
* @return 是否准备成功
|
|
*/
|
|
boolean prepare(String transactionId);
|
|
|
|
/**
|
|
* 提交阶段
|
|
* @param transactionId 事务ID
|
|
*/
|
|
void commit(String transactionId);
|
|
|
|
/**
|
|
* 回滚阶段
|
|
* @param transactionId 事务ID
|
|
*/
|
|
void rollback(String transactionId);
|
|
|
|
/**
|
|
* 获取参与者ID
|
|
* @return 参与者ID
|
|
*/
|
|
String getParticipantId();
|
|
} |