Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: optimize TCC structure, supporting API access #5165

Merged
merged 145 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
f6f1b9e
solve spring and tcc dependency issue
sunrui1225 May 26, 2022
3b116b5
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 May 26, 2022
444e478
add Copyright
sunrui1225 May 28, 2022
6805106
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Jun 2, 2022
b89d3a5
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Jun 7, 2022
07e1a94
Merge branch 'develop' into feature_spring_tcc_dependency
funky-eyes Jul 4, 2022
927af96
fix add final to static method.
sunrui1225 Jul 5, 2022
ff7980d
fix check style.
sunrui1225 Jul 5, 2022
d88d30e
Merge branch 'develop' into feature_spring_tcc_dependency
wangliang181230 Jul 8, 2022
b717343
remove no used codes. rename method name.
sunrui1225 Jul 8, 2022
f8fbe59
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Jul 8, 2022
cd17b70
Merge branch 'develop' into feature_spring_tcc_dependency
funky-eyes Jul 15, 2022
c08d092
Merge branch 'develop' into feature_spring_tcc_dependency
wangliang181230 Jul 21, 2022
cc48ff0
Merge branch 'develop' into feature_spring_tcc_dependency
wangliang181230 Jul 21, 2022
d7e5254
Merge remote-tracking branch 'origin/feature_spring_tcc_dependency' i…
sunrui1225 Jul 24, 2022
787d747
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Jul 24, 2022
21b3054
Merge remote-tracking branch 'origin/feature_spring_tcc_dependency' i…
sunrui1225 Jul 24, 2022
14fe43a
syn update from saga annotation to this pr
sunrui1225 Jul 24, 2022
ae69922
Merge branch 'develop' into feature_spring_tcc_dependency
wangliang181230 Jul 26, 2022
912c925
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Jul 29, 2022
df24269
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Aug 3, 2022
d6cb132
Merge remote-tracking branch 'origin/develop' into spring_tcc_depende…
sunrui1225 Sep 22, 2022
06475ac
merge
sunrui1225 Sep 22, 2022
21a7a88
manual api draft
sunrui1225 Sep 24, 2022
067659b
fix RemotingParser file issue
sunrui1225 Sep 30, 2022
0904a1b
add java doc
sunrui1225 Oct 15, 2022
fbc3f24
add temporary TCCFenceHandler to resolve conflict
sunrui1225 Oct 15, 2022
a022866
Merge branch 'develop' into feature_spring_tcc_dependency
sunrui1225 Oct 15, 2022
b9b1f90
delite temporary TCCFenceHandler
sunrui1225 Oct 15, 2022
afbd0ae
Merge remote-tracking branch 'origin/feature_spring_tcc_dependency' i…
sunrui1225 Oct 15, 2022
119488e
add copyright
sunrui1225 Oct 15, 2022
30d759d
check style
sunrui1225 Oct 15, 2022
00e7666
check style
sunrui1225 Oct 15, 2022
a4d3eb8
fix build error
sunrui1225 Oct 15, 2022
c2b2d67
add byte-buddy dependency
leezongjie Dec 8, 2022
452a116
remove spring dependency 1
leezongjie Dec 9, 2022
647bc45
Merge pull request #1 from ant-transaction/remove_spring_dependency
leezongjie Dec 9, 2022
2027c10
梳理tcc切面生成过程
leezongjie Dec 9, 2022
7580673
Merge pull request #2 from ant-transaction/remove_spring_dependency
leezongjie Dec 9, 2022
60cf11f
测试流程
leezongjie Dec 15, 2022
9362b3a
Merge pull request #3 from ant-transaction/remove_spring_dependency
leezongjie Dec 15, 2022
8b1b174
remove used dependecy
sunrui1225 Dec 15, 2022
bada117
roll back codes
sunrui1225 Dec 15, 2022
ed29990
remove useless codes
sunrui1225 Dec 17, 2022
9192452
Merge branch 'feature_spring_tcc_dependency' into spring_tcc_dependen…
sunrui1225 Dec 17, 2022
e54fb84
添加分支注册接口
leezongjie Dec 17, 2022
252d405
Merge remote-tracking branch 'upstream/spring_tcc_dependency_manual_a…
leezongjie Dec 17, 2022
19a1b29
Merge pull request #4 from ant-transaction/remove_spring_dependency
leezongjie Dec 17, 2022
eb58be9
去common模块spring依赖
leezongjie Dec 17, 2022
2055faa
Merge pull request #5 from ant-transaction/remove_spring_dependency
leezongjie Dec 17, 2022
acb11eb
Merge remote-tracking branch 'origin/spring_tcc_dependency_manual_api…
sunrui1225 Dec 17, 2022
14059ce
fix 编译error
leezongjie Dec 17, 2022
b382d41
Merge remote-tracking branch 'upstream/spring_tcc_dependency_manual_a…
leezongjie Dec 17, 2022
ab2cbb4
Merge pull request #6 from ant-transaction/remove_spring_dependency
leezongjie Dec 17, 2022
632377d
Merge remote-tracking branch 'origin/spring_tcc_dependency_manual_api…
sunrui1225 Dec 17, 2022
c058949
fix conflict
sunrui1225 Dec 18, 2022
b541224
fix conflict
sunrui1225 Dec 18, 2022
eb03c17
fix conflict
sunrui1225 Dec 18, 2022
f867cf4
fix conflict
sunrui1225 Dec 18, 2022
834ecf3
fix conflict
sunrui1225 Dec 18, 2022
e6370b9
fix conflict
sunrui1225 Dec 18, 2022
b14f92c
fix conflict
sunrui1225 Dec 18, 2022
0b6adb6
Copyright
sunrui1225 Dec 21, 2022
3605781
add doc
sunrui1225 Dec 22, 2022
f86ab4d
兼容原有api
leezongjie Dec 23, 2022
bd2972f
Merge remote-tracking branch 'upstream/spring_tcc_dependency_manual_a…
leezongjie Dec 23, 2022
6a6cf8b
Merge pull request #7 from ant-transaction/remove_spring_dependency
leezongjie Dec 23, 2022
30bfd3e
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Dec 24, 2022
bed0d24
fix conflict
sunrui1225 Dec 24, 2022
2397c63
add Copyright
sunrui1225 Dec 24, 2022
578774c
fix checkstyle
sunrui1225 Dec 24, 2022
adb62ec
fix checkstyle
sunrui1225 Dec 25, 2022
c90b928
fix checkstyle
sunrui1225 Dec 25, 2022
aa88b42
fix checkstyle
sunrui1225 Dec 25, 2022
ce26a80
fix checkstyle
sunrui1225 Dec 25, 2022
b834954
rollback makeMethodDesc
sunrui1225 Dec 25, 2022
2a6e5f9
fix checkstyle
sunrui1225 Dec 25, 2022
0283f7a
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Dec 26, 2022
9d76b4d
去除新添加的api
leezongjie Dec 27, 2022
66f997c
Merge remote-tracking branch 'upstream/spring_tcc_dependency_manual_a…
leezongjie Dec 27, 2022
ceeb048
Merge pull request #8 from ant-transaction/remove_spring_dependency
leezongjie Dec 27, 2022
96a9b01
fix checkstyle
sunrui1225 Dec 27, 2022
cb6b1eb
remove log
sunrui1225 Dec 27, 2022
a783a84
Merge branch 'develop' into spring_tcc_dependency_manual_api
funky-eyes Dec 29, 2022
fe96744
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Jan 3, 2023
23f3d47
seata version 2.0.0-SNAPSHOT
sunrui1225 Jan 7, 2023
294f32a
file path updated
sunrui1225 Jan 7, 2023
9f39d90
add final
sunrui1225 Jan 7, 2023
abf8c5a
update to private final
sunrui1225 Jan 7, 2023
6efec75
use io.seata.common.ConfigurationKeys
sunrui1225 Jan 7, 2023
53146e4
use DEFAULT_FAIL_HANDLER
sunrui1225 Jan 7, 2023
da58757
use Class<?>[]
sunrui1225 Jan 7, 2023
7478f88
remove manual-api
sunrui1225 Jan 7, 2023
c736595
use Class<?>
sunrui1225 Jan 7, 2023
00f8114
check style
sunrui1225 Jan 7, 2023
29e2ba2
remove manual all
sunrui1225 Jan 7, 2023
583e486
fix methodsToProxy
sunrui1225 Jan 7, 2023
1b1aab7
Merge branch 'develop' into spring_tcc_dependency_manual_api
wangliang181230 Jan 9, 2023
0f9fed3
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Jan 10, 2023
1c5b053
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Jan 10, 2023
ea45743
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Jan 11, 2023
e9f14ae
Merge remote-tracking branch 'origin/spring_tcc_dependency_manual_api…
sunrui1225 Jan 11, 2023
efe4860
rename common-api to seata-integration-api
sunrui1225 Jan 11, 2023
b7e5998
rollback AspectTransactionalInterceptor
sunrui1225 Jan 12, 2023
d4506f2
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Jan 12, 2023
1efd44a
optimize imports
sunrui1225 Jan 13, 2023
0e6ed7f
Merge remote-tracking branch 'origin/spring_tcc_dependency_manual_api…
sunrui1225 Jan 13, 2023
0af6c8b
optimize imports
sunrui1225 Jan 13, 2023
760eaea
code reviews update
sunrui1225 Jan 13, 2023
e0cc06a
move ActionInterceptorHandlerTest to integration api
sunrui1225 Jan 13, 2023
bc39636
update MethodDescTest
sunrui1225 Jan 13, 2023
9ebf56c
去除integration-api模块对fastjson的依赖,待通用模块序列化提交后再修改使用实现
leezongjie Jan 13, 2023
d41f24c
fix:暴露用户可以自定义FailureHandler
leezongjie Jan 13, 2023
3c18eae
fix 包路径
leezongjie Jan 13, 2023
8332da4
Merge pull request #9 from ant-transaction/remove_spring_dependency
leezongjie Jan 13, 2023
1601d40
add license header
sunrui1225 Jan 14, 2023
c5cfcfe
check style
sunrui1225 Jan 14, 2023
e24eccd
update GlobalTransactionalInterceptorHandler to final filed
sunrui1225 Jan 15, 2023
c40b528
check style
sunrui1225 Jan 15, 2023
8c3dc73
fix pr##5165
leezongjie Jan 15, 2023
93a251c
Merge pull request #10 from ant-transaction/remove_spring_dependency
leezongjie Jan 15, 2023
bff2db4
fix pr##5165 pmd
leezongjie Jan 15, 2023
7945e05
Merge pull request #11 from ant-transaction/remove_spring_dependency
leezongjie Jan 15, 2023
4de670e
fix pr##5165
leezongjie Jan 15, 2023
ef9d06c
Merge remote-tracking branch 'upstream/spring_tcc_dependency_manual_a…
leezongjie Jan 15, 2023
9a420da
Merge pull request #12 from ant-transaction/remove_spring_dependency
leezongjie Jan 15, 2023
3bbdf45
fix import
leezongjie Jan 15, 2023
7b7211c
Merge remote-tracking branch 'upstream/spring_tcc_dependency_manual_a…
leezongjie Jan 15, 2023
75c29a6
Merge pull request #13 from ant-transaction/remove_spring_dependency
leezongjie Jan 15, 2023
6a37ec5
fix test
leezongjie Jan 15, 2023
f801b35
Merge pull request #14 from ant-transaction/remove_spring_dependency
leezongjie Jan 15, 2023
cc7978a
reimport
sunrui1225 Jan 16, 2023
82ad13f
remove unused annotations
sunrui1225 Jan 17, 2023
d20ad27
rename integration-tx-api
sunrui1225 Jan 17, 2023
8f843b6
remove space
sunrui1225 Jan 17, 2023
29fcee6
Merge branch 'develop' into spring_tcc_dependency_manual_api
funky-eyes Jan 28, 2023
a8a81d7
Merge branch 'develop' into spring_tcc_dependency_manual_api
sunrui1225 Jan 30, 2023
be03980
resolve conflicts
sunrui1225 Jan 30, 2023
8488624
rerun ci
sunrui1225 Jan 30, 2023
9d070e6
rerun ci
sunrui1225 Jan 30, 2023
ff4e453
rerun ci
sunrui1225 Jan 30, 2023
2283b01
Merge remote-tracking branch 'origin/spring_tcc_dependency_manual_api…
sunrui1225 Jan 30, 2023
8b39007
add changes.
sunrui1225 Jan 30, 2023
409c97d
code review revised
sunrui1225 Jan 31, 2023
582c4e3
reimport
sunrui1225 Jan 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,6 @@
<artifactId>edas-sdk</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
Expand Down Expand Up @@ -600,6 +596,10 @@
<artifactId>lz4-java</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

<properties>
<!-- seata version -->
<revision>1.7.0-SNAPSHOT</revision>
<revision>2.0.0-SNAPSHOT</revision>

<!-- Compiler settings properties -->
<java.version>1.8</java.version>
Expand Down
2 changes: 1 addition & 1 deletion changes/en-us/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Seata is an easy-to-use, high-performance, open source distributed transaction s
The version is updated as follows:

### feature:
- [[#1234](https://github.com/seata/seata/pull/1234)] Please delete the sample later
- [[#5165](https://github.com/seata/seata/pull/5165)] optimize TCC structure, supporting API access. add integration layer module(seata-integration-tx-api) for transaction process definition and proxy enhancement.

### bugfix:
- [[#1234](https://github.com/seata/seata/pull/1234)] Please delete the sample later
Expand Down
2 changes: 1 addition & 1 deletion changes/zh-cn/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
此版本更新如下:

### feature:
- [[#1234](https://github.com/seata/seata/pull/1234)] 样例,后续请删除
- [[#5165](https://github.com/seata/seata/pull/5165)] TCC结构拆分,支持API方式接入。增加集成层模块(seata-integration-tx-api),对事务流程定义以及代理部分增强。

### bugfix:
- [[#1234](https://github.com/seata/seata/pull/1234)] 样例,后续请删除
Expand Down
11 changes: 8 additions & 3 deletions common/src/main/java/io/seata/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public interface Constants {
/**
* Use TCC fence
*/
String USE_TCC_FENCE = "useTCCFence";
String USE_COMMON_FENCE = "useTCCFence";

/**
* phase one method name
Expand All @@ -94,7 +94,7 @@ public interface Constants {
/**
* branch context
*/
String TCC_ACTION_CONTEXT = "actionContext";
String TX_ACTION_CONTEXT = "actionContext";

/**
* default charset name
Expand Down Expand Up @@ -165,5 +165,10 @@ public interface Constants {
* The constant REGISTRY_TYPE_SPLIT_CHAR.
*/
String REGISTRY_TYPE_SPLIT_CHAR = ",";

/**
* phase two compensation method name
*/
String COMPENSATION_METHOD = "sys::compensation";

}
}
19 changes: 12 additions & 7 deletions common/src/main/java/io/seata/common/DefaultValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,28 @@ public interface DefaultValues {
*/
int TCC_ACTION_INTERCEPTOR_ORDER = Integer.MIN_VALUE + 1000;

/**
* the constant SAGA_ACTION_INTERCEPTOR_ORDER
*/
int SAGA_ACTION_INTERCEPTOR_ORDER = Integer.MIN_VALUE + 1000;

/**
* the constant DEFAULT_DISTRIBUTED_LOCK_EXPIRE
*/
int DEFAULT_DISTRIBUTED_LOCK_EXPIRE = 10000;

/**
* the constant DEFAULT_TCC_FENCE_CLEAN_PERIOD
* the constant DEFAULT_COMMON_FENCE_CLEAN_PERIOD
*/
int DEFAULT_TCC_FENCE_CLEAN_PERIOD = 1;
int DEFAULT_COMMON_FENCE_CLEAN_PERIOD = 1;
/**
* the constant DEFAULT_TCC_FENCE_LOG_TABLE_NAME
* the constant DEFAULT_COMMON_FENCE_LOG_TABLE_NAME
*/
String DEFAULT_TCC_FENCE_LOG_TABLE_NAME = "tcc_fence_log";
String DEFAULT_COMMON_FENCE_LOG_TABLE_NAME = "tcc_fence_log";
/**
* the constant TCC_FENCE_BEAN_NAME
* the constant COMMON_FENCE_BEAN_NAME
*/
String TCC_FENCE_BEAN_NAME = "tccFenceConfig";
String COMMON_FENCE_BEAN_NAME = "tccFenceConfig";

/**
* the constant DEFAULT_RPC_RM_REQUEST_TIMEOUT
Expand Down Expand Up @@ -286,4 +291,4 @@ public interface DefaultValues {
* Default druid location in classpath
*/
String DRUID_LOCATION = "lib/sqlparser/druid.jar";
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/io/seata/core/protocol/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Version {
/**
* The constant CURRENT.
*/
private static final String CURRENT = "1.7.0-SNAPSHOT";
private static final String CURRENT = "2.0.0-SNAPSHOT";
private static final String VERSION_0_7_1 = "0.7.1";
private static final String VERSION_1_5_0 = "1.5.0";
private static final int MAX_VERSION_DOT = 3;
Expand Down
2 changes: 1 addition & 1 deletion dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<dubbo-seata.version>1.0.2</dubbo-seata.version>
<brpc.version>2.5.9</brpc.version>
<hsf.version>1.8.3</hsf.version>
<bytebuddy.version>1.12.13</bytebuddy.version>
<dubbo.alibaba.version>2.6.10</dubbo.alibaba.version>
<sofa.rpc.version>5.5.3</sofa.rpc.version>
<fastjson.version>1.2.83</fastjson.version>
Expand Down Expand Up @@ -114,6 +113,7 @@
<mockito.version>2.23.4</mockito.version>
<assertj-core.version>3.12.2</assertj-core.version>
<jetty-version>9.4.38.v20210224</jetty-version>
<bytebuddy.version>1.12.17</bytebuddy.version>
</properties>

<dependencyManagement>
Expand Down
64 changes: 64 additions & 0 deletions integration-tx-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 1999-2019 Seata.io Group.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.seata</groupId>
<artifactId>seata-parent</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>seata-integration-tx-api</artifactId>
<name>seata-integration-tx-api ${project.version}</name>
<packaging>jar</packaging>


<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-tm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-rm-datasource</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-rm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-serializer-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.spring.annotation;
package io.seata.integration.tx.api.annotation;

import io.seata.common.DefaultValues;
import io.seata.common.LockStrategyMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.integration.tx.api.annotation;

import io.seata.common.util.StringUtils;
import io.seata.rm.tcc.api.BusinessActionContextParameter;

import java.lang.annotation.Annotation;

/**
* @author leezongjie
* @date 2022/12/23
*/
public class BusinessActionContextParameterDesc {
private String paramName;
private int index;
private boolean isParamInProperty;

private BusinessActionContextParameterDesc() {
}

public static BusinessActionContextParameterDesc createFromBusinessActionContextParameter(Annotation annotation) {
if (annotation == null) {
return null;
}
BusinessActionContextParameterDesc businessActionContextParameterDesc = null;
if (annotation instanceof BusinessActionContextParameter) {
businessActionContextParameterDesc = new BusinessActionContextParameterDesc();
BusinessActionContextParameter businessActionContextParameter = (BusinessActionContextParameter) annotation;
businessActionContextParameterDesc.setIndex(businessActionContextParameter.index());
businessActionContextParameterDesc.setParamInProperty(businessActionContextParameter.isParamInProperty());
businessActionContextParameterDesc.setParamName(StringUtils.isNotBlank(businessActionContextParameter.paramName()) ? businessActionContextParameter.paramName() : businessActionContextParameter.value());
}
return businessActionContextParameterDesc;
}

public String getParamName() {
return paramName;
}

public void setParamName(String paramName) {
this.paramName = paramName;
}

public int getIndex() {
return index;
}

public void setIndex(int index) {
this.index = index;
}

public boolean isParamInProperty() {
return isParamInProperty;
}

public void setParamInProperty(boolean paramInProperty) {
isParamInProperty = paramInProperty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.spring.event;
package io.seata.integration.tx.api.event;

import io.seata.core.event.Event;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.integration.tx.api.fence;

import io.seata.common.executor.Callback;

import java.lang.reflect.Method;
import java.util.Date;

/**
* @author leezongjie
* @date 2022/12/17
*/
public class DefaultCommonFenceHandler implements FenceHandler {

private FenceHandler fenceHandler;

private static class SingletonHolder {
private static final DefaultCommonFenceHandler INSTANCE = new DefaultCommonFenceHandler();
}

public static DefaultCommonFenceHandler get() {
return DefaultCommonFenceHandler.SingletonHolder.INSTANCE;
}

public void setFenceHandler(FenceHandler fenceHandler) {
this.fenceHandler = fenceHandler;
}

private void check() {
if (fenceHandler == null) {
throw new RuntimeException("fenceHandler is null, need to set a fenceHandler implement");
}
}

@Override
public Object prepareFence(String xid, Long branchId, String actionName, Callback<Object> targetCallback) {
check();
return fenceHandler.prepareFence(xid, branchId, actionName, targetCallback);
}

@Override
public boolean commitFence(Method commitMethod, Object targetTCCBean, String xid, Long branchId, Object[] args) {
check();
return fenceHandler.commitFence(commitMethod, targetTCCBean, xid, branchId, args);
}

@Override
public boolean rollbackFence(Method rollbackMethod, Object targetTCCBean, String xid, Long branchId, Object[] args, String actionName) {
check();
return fenceHandler.rollbackFence(rollbackMethod, targetTCCBean, xid, branchId, args, actionName);
}

@Override
public int deleteFenceByDate(Date datetime) {
check();
return fenceHandler.deleteFenceByDate(datetime);
}
}
Loading