diff --git a/spring-cloud-alibaba-dependencies/pom.xml b/spring-cloud-alibaba-dependencies/pom.xml
index fc4b5d4d..54f43ce7 100644
--- a/spring-cloud-alibaba-dependencies/pom.xml
+++ b/spring-cloud-alibaba-dependencies/pom.xml
@@ -19,21 +19,21 @@
1.6.1
3.1.0
- 0.4.2
+ 0.5.1
1.0.0
0.8.0
- 1.0.8
+ 1.0.9
1.0.1
- 4.0.1
+ 4.4.1
1.0.5
- 2.16.0
+ 2.44.0
2.0.2
2.1.6
2.7.1
2.7.1
- 0.0.2
+ 2.7.1
1.1.0
- 1.1.8
+ 1.1.8.6
1.1.1
@@ -205,12 +205,13 @@
-
+
+
- com.alibaba.fescar
- fescar-spring
- ${fescar.version}
+ io.seata
+ seata-spring
+ ${seata.version}
@@ -243,7 +244,7 @@
- com.alibaba
+ org.apache.dubbo
dubbo-registry-nacos
${dubbo-registry-nacos.version}
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/AccountController.java b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/AccountController.java
index 3738fb87..7023438a 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/AccountController.java
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/AccountController.java
@@ -17,7 +17,7 @@ package org.springframework.cloud.alibaba.cloud.examples;
import java.util.Random;
-import com.alibaba.fescar.core.context.RootContext;
+import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
index f3ccf818..f1a6a50c 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
@@ -16,17 +16,16 @@
package org.springframework.cloud.alibaba.cloud.examples;
import java.sql.SQLException;
-import java.util.Random;
+import com.alibaba.druid.pool.DruidDataSource;
+
+import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
-import com.alibaba.druid.pool.DruidDataSource;
-import com.alibaba.fescar.rm.datasource.DataSourceProxy;
-
/**
* @author xiaojing
*/
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf
index 857b089e..b49739a1 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/file.conf
@@ -20,17 +20,26 @@ transport {
worker-thread-size = 8
}
}
+store {
+ # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+ max-branch-session-size = 16384
+ # globe session size , if exceeded throws exceptions
+ max-global-session-size = 512
+ # file buffer size , if exceeded allocate new buffer
+ file-write-buffer-cache-size = 16384
+ # when recover batch read size
+ session.reload.read_size = 100
+}
service {
#vgroup->rgroup
- vgroup_mapping.account-service-fescar-service-group = "localRgroup"
+ vgroup_mapping.account-service-fescar-service-group = "default"
#only support single node
- localRgroup.grouplist = "127.0.0.1:8091"
+ default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
-
client {
async.commit.buffer.limit = 10000
lock {
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf
index 8a79c9f2..587f8bcb 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/registry.conf
@@ -1,5 +1,5 @@
registry {
- # file 、nacos 、redis
+ # file 、nacos 、eureka、redis、zk、consul
type = "file"
nacos {
@@ -7,17 +7,32 @@ registry {
namespace = "public"
cluster = "default"
}
+ eureka {
+ serviceUrl = "http://localhost:1001/eureka"
+ application = "default"
+ weight = "1"
+ }
redis {
serverAddr = "localhost:6379"
db = "0"
}
+ zk {
+ cluster = "default"
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
+ consul {
+ cluster = "default"
+ serverAddr = "127.0.0.1:8500"
+ }
file {
name = "file.conf"
}
}
config {
- # file nacos apollo
+ # file、nacos 、apollo、zk
type = "file"
nacos {
@@ -29,6 +44,11 @@ config {
app.id = "fescar-server"
apollo.meta = "http://192.168.1.204:8801"
}
+ zk {
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
file {
name = "file.conf"
}
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/HomeController.java b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/HomeController.java
index 039074ec..0226f964 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/HomeController.java
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/HomeController.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.alibaba.cloud.examples;
-import com.alibaba.fescar.spring.annotation.GlobalTransactional;
+import io.seata.spring.annotation.GlobalTransactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf
index b087a18c..cb1ab8bb 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/file.conf
@@ -20,17 +20,46 @@ transport {
worker-thread-size = 8
}
}
+## transaction log store
+store {
+ ## store mode: file、db
+ mode = "file"
+
+ ## file store
+ file {
+ dir = "sessionStore"
+
+ # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+ max-branch-session-size = 16384
+ # globe session size , if exceeded throws exceptions
+ max-global-session-size = 512
+ # file buffer size , if exceeded allocate new buffer
+ file-write-buffer-cache-size = 16384
+ # when recover batch read size
+ session.reload.read_size = 100
+ # async, sync
+ flush-disk-mode = async
+ }
+
+ ## database store
+ db {
+ driver_class = ""
+ url = ""
+ user = ""
+ password = ""
+ }
+
+}
service {
#vgroup->rgroup
- vgroup_mapping.business-service-fescar-service-group = "localRgroup"
+ vgroup_mapping.business-service-fescar-service-group = "default"
#only support single node
- localRgroup.grouplist = "127.0.0.1:8091"
+ default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
-
client {
async.commit.buffer.limit = 10000
lock {
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf
index 8a79c9f2..7d71afaa 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/registry.conf
@@ -1,5 +1,5 @@
registry {
- # file 、nacos 、redis
+ # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "file"
nacos {
@@ -7,17 +7,45 @@ registry {
namespace = "public"
cluster = "default"
}
+ eureka {
+ serviceUrl = "http://localhost:1001/eureka"
+ application = "default"
+ weight = "1"
+ }
redis {
serverAddr = "localhost:6379"
db = "0"
}
+ zk {
+ cluster = "default"
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
+ consul {
+ cluster = "default"
+ serverAddr = "127.0.0.1:8500"
+ }
+ etcd3 {
+ cluster = "default"
+ serverAddr = "http://localhost:2379"
+ }
+ sofa {
+ serverAddr = "127.0.0.1:9603"
+ application = "default"
+ region = "DEFAULT_ZONE"
+ datacenter = "DefaultDataCenter"
+ cluster = "default"
+ group = "SEATA_GROUP"
+ addressWaitTime = "3000"
+ }
file {
name = "file.conf"
}
}
config {
- # file nacos apollo
+ # file、nacos 、apollo、zk
type = "file"
nacos {
@@ -26,9 +54,14 @@ config {
cluster = "default"
}
apollo {
- app.id = "fescar-server"
+ app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801"
}
+ zk {
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
file {
name = "file.conf"
}
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
index 035eb7ee..5ec93801 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
@@ -24,7 +24,7 @@ import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import com.alibaba.druid.pool.DruidDataSource;
-import com.alibaba.fescar.rm.datasource.DataSourceProxy;
+import io.seata.rm.datasource.DataSourceProxy;
/**
* @author xiaojing
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/OrderController.java b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/OrderController.java
index d215588d..db294ed1 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/OrderController.java
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/OrderController.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.alibaba.cloud.examples;
-import com.alibaba.fescar.core.context.RootContext;
+import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf
index 4f893da5..7213edea 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/file.conf
@@ -20,17 +20,46 @@ transport {
worker-thread-size = 8
}
}
+## transaction log store
+store {
+ ## store mode: file、db
+ mode = "file"
+
+ ## file store
+ file {
+ dir = "sessionStore"
+
+ # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+ max-branch-session-size = 16384
+ # globe session size , if exceeded throws exceptions
+ max-global-session-size = 512
+ # file buffer size , if exceeded allocate new buffer
+ file-write-buffer-cache-size = 16384
+ # when recover batch read size
+ session.reload.read_size = 100
+ # async, sync
+ flush-disk-mode = async
+ }
+
+ ## database store
+ db {
+ driver_class = ""
+ url = ""
+ user = ""
+ password = ""
+ }
+
+}
service {
#vgroup->rgroup
- vgroup_mapping.order-service-fescar-service-group = "localRgroup"
+ vgroup_mapping.order-service-fescar-service-group = "default"
#only support single node
- localRgroup.grouplist = "127.0.0.1:8091"
+ default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
-
client {
async.commit.buffer.limit = 10000
lock {
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf
index 8a79c9f2..7d71afaa 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/registry.conf
@@ -1,5 +1,5 @@
registry {
- # file 、nacos 、redis
+ # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "file"
nacos {
@@ -7,17 +7,45 @@ registry {
namespace = "public"
cluster = "default"
}
+ eureka {
+ serviceUrl = "http://localhost:1001/eureka"
+ application = "default"
+ weight = "1"
+ }
redis {
serverAddr = "localhost:6379"
db = "0"
}
+ zk {
+ cluster = "default"
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
+ consul {
+ cluster = "default"
+ serverAddr = "127.0.0.1:8500"
+ }
+ etcd3 {
+ cluster = "default"
+ serverAddr = "http://localhost:2379"
+ }
+ sofa {
+ serverAddr = "127.0.0.1:9603"
+ application = "default"
+ region = "DEFAULT_ZONE"
+ datacenter = "DefaultDataCenter"
+ cluster = "default"
+ group = "SEATA_GROUP"
+ addressWaitTime = "3000"
+ }
file {
name = "file.conf"
}
}
config {
- # file nacos apollo
+ # file、nacos 、apollo、zk
type = "file"
nacos {
@@ -26,9 +54,14 @@ config {
cluster = "default"
}
apollo {
- app.id = "fescar-server"
+ app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801"
}
+ zk {
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
file {
name = "file.conf"
}
diff --git a/spring-cloud-alibaba-examples/seata-example/readme-zh.md b/spring-cloud-alibaba-examples/seata-example/readme-zh.md
index 6c1b6747..9c12eb50 100644
--- a/spring-cloud-alibaba-examples/seata-example/readme-zh.md
+++ b/spring-cloud-alibaba-examples/seata-example/readme-zh.md
@@ -19,14 +19,14 @@
1. 创建 示例中 业务所需要的数据库表
-1. 启动 Fescar Server
+1. 启动 Seata Server
### 配置数据库
首先,你需要有一个支持 InnoDB 引擎的 MySQL 数据库。
-**注意**: 实际上,Fescar 支持不同的应用使用完全不相干的数据库,但是这里为了简单地演示一个原理,所以我们选择了只使用一个数据库。
+**注意**: 实际上,Seata 支持不同的应用使用完全不相干的数据库,但是这里为了简单地演示一个原理,所以我们选择了只使用一个数据库。
将 `account-server`、`order-service`、`storage-service` 这三个应用中的 resources 目录下的 `application.properties` 文件中的如下配置修改成你运行环境中的实际配置。
@@ -42,7 +42,7 @@ mysql.user.password=your mysql server password
### 创建 undo_log 表
-[Fescar AT 模式]() 需要使用到 undo_log 表。
+[Seata AT 模式]() 需要使用到 undo_log 表。
``` $sql
-- 注意此处0.3.0+ 增加唯一索引 ux_undo_log
@@ -93,24 +93,24 @@ CREATE TABLE `account_tbl` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```
-### 启动 Fescar Server
+### 启动 Seata Server
-点击这个页面 [https://github.com/alibaba/fescar/releases](https://github.com/alibaba/fescar/releases),下载最新版本的 Fescar Server 端.
+点击这个页面 [https://github.com/seata/seata/releases](https://github.com/seata/seata/releases),下载最新版本的 Seata Server 端.
进入解压之后的 bin 目录,执行如下命令来启动
```$shell
-sh fescar-server.sh $LISTEN_PORT $PATH_FOR_PERSISTENT_DATA
+sh seata-server.sh $LISTEN_PORT $MODE(file or db)
```
-在这个示例中,采用如下命令来启动 Fescar Server
+在这个示例中,采用如下命令来启动 Seata Server
```$shell
-sh fescar-server.sh 8091 ~/fescar/data/
+sh seata-server.sh 8091 file
```
-**注意** 如果你修改了端口号,那么记得需要在各个示例工程中的 `application.conf` 文件中,修改 grouplist 的值。
+**注意** 如果你修改了endpoint且注册中心使用默认file类型,那么记得需要在各个示例工程中的 `file.conf` 文件中,修改 grouplist 的值(当registry.conf 中registry.type 或 config.type 为file 时会读取内部的file节点中的文件名,若type不为file将直接从配置类型的对应元数据的注册配置中心读取数据),推荐大家使用 nacos 作为配置注册中心。
## 运行示例
@@ -146,12 +146,12 @@ http://127.0.0.1:18081/fescar/rest
## 对 Spring Cloud 支持点
-- 通过 Spring MVC 提供服务的服务提供者,在收到 header 中含有 Fescar 信息的 HTTP 请求时,可以自动还原 Fescar 上下文。
+- 通过 Spring MVC 提供服务的服务提供者,在收到 header 中含有 Seata 信息的 HTTP 请求时,可以自动还原 Seata 上下文。
-- 支持服务调用者通过 RestTemplate 调用时,自动传递 Fescar 上下文。
+- 支持服务调用者通过 RestTemplate 调用时,自动传递 Seata 上下文。
-- 支持服务调用者通过 FeignClient 调用时,自动传递 Fescar 上下文。
+- 支持服务调用者通过 FeignClient 调用时,自动传递 Seata 上下文。
-- 支持 FeignClient 和 Hystrix 同时使用的场景。
+- 支持 SeataClient 和 Hystrix 同时使用的场景。
-- 支持 FeignClient 和 Sentinel 同时使用的场景。
+- 支持 SeataClient 和 Sentinel 同时使用的场景。
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
index 8e4ccf7d..99b89f63 100644
--- a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
+++ b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/DatabaseConfiguration.java
@@ -19,7 +19,7 @@ package org.springframework.cloud.alibaba.cloud.examples;
import java.sql.SQLException;
import com.alibaba.druid.pool.DruidDataSource;
-import com.alibaba.fescar.rm.datasource.DataSourceProxy;
+import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/StorageController.java b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/StorageController.java
index fd97ab2c..31552104 100644
--- a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/StorageController.java
+++ b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/org/springframework/cloud/alibaba/cloud/examples/StorageController.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.alibaba.cloud.examples;
-import com.alibaba.fescar.core.context.RootContext;
+import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf
index 29c81842..4699d684 100644
--- a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf
+++ b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/file.conf
@@ -20,17 +20,46 @@ transport {
worker-thread-size = 8
}
}
+## transaction log store
+store {
+ ## store mode: file、db
+ mode = "file"
+
+ ## file store
+ file {
+ dir = "sessionStore"
+
+ # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+ max-branch-session-size = 16384
+ # globe session size , if exceeded throws exceptions
+ max-global-session-size = 512
+ # file buffer size , if exceeded allocate new buffer
+ file-write-buffer-cache-size = 16384
+ # when recover batch read size
+ session.reload.read_size = 100
+ # async, sync
+ flush-disk-mode = async
+ }
+
+ ## database store
+ db {
+ driver_class = ""
+ url = ""
+ user = ""
+ password = ""
+ }
+
+}
service {
#vgroup->rgroup
- vgroup_mapping.storage-service-fescar-service-group = "localRgroup"
+ vgroup_mapping.storage-service-fescar-service-group = "default"
#only support single node
- localRgroup.grouplist = "127.0.0.1:8091"
+ default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
-
client {
async.commit.buffer.limit = 10000
lock {
diff --git a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf
index 8a79c9f2..7d71afaa 100644
--- a/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf
+++ b/spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/registry.conf
@@ -1,5 +1,5 @@
registry {
- # file 、nacos 、redis
+ # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "file"
nacos {
@@ -7,17 +7,45 @@ registry {
namespace = "public"
cluster = "default"
}
+ eureka {
+ serviceUrl = "http://localhost:1001/eureka"
+ application = "default"
+ weight = "1"
+ }
redis {
serverAddr = "localhost:6379"
db = "0"
}
+ zk {
+ cluster = "default"
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
+ consul {
+ cluster = "default"
+ serverAddr = "127.0.0.1:8500"
+ }
+ etcd3 {
+ cluster = "default"
+ serverAddr = "http://localhost:2379"
+ }
+ sofa {
+ serverAddr = "127.0.0.1:9603"
+ application = "default"
+ region = "DEFAULT_ZONE"
+ datacenter = "DefaultDataCenter"
+ cluster = "default"
+ group = "SEATA_GROUP"
+ addressWaitTime = "3000"
+ }
file {
name = "file.conf"
}
}
config {
- # file nacos apollo
+ # file、nacos 、apollo、zk
type = "file"
nacos {
@@ -26,9 +54,14 @@ config {
cluster = "default"
}
apollo {
- app.id = "fescar-server"
+ app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801"
}
+ zk {
+ serverAddr = "127.0.0.1:2181"
+ session.timeout = 6000
+ connect.timeout = 2000
+ }
file {
name = "file.conf"
}
diff --git a/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosPropertySourceRepository.java b/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosPropertySourceRepository.java
index 0a0cc00c..6fa8e490 100644
--- a/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosPropertySourceRepository.java
+++ b/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosPropertySourceRepository.java
@@ -28,25 +28,25 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class NacosPropertySourceRepository {
- private final static ConcurrentHashMap nacosPropertySourceRepository = new ConcurrentHashMap<>();
+ private final static ConcurrentHashMap NACOS_PROPERTY_SOURCE_REPOSITORY = new ConcurrentHashMap<>();
/**
* @return all nacos properties from application context
*/
public static List getAll() {
List result = new ArrayList<>();
- result.addAll(nacosPropertySourceRepository.values());
+ result.addAll(NACOS_PROPERTY_SOURCE_REPOSITORY.values());
return result;
}
public static void collectNacosPropertySources(
NacosPropertySource nacosPropertySource) {
- nacosPropertySourceRepository.putIfAbsent(nacosPropertySource.getDataId(),
+ NACOS_PROPERTY_SOURCE_REPOSITORY.putIfAbsent(nacosPropertySource.getDataId(),
nacosPropertySource);
}
public static NacosPropertySource getNacosPropertySource(String dataId) {
- return nacosPropertySourceRepository.get(dataId);
+ return NACOS_PROPERTY_SOURCE_REPOSITORY.get(dataId);
}
}
diff --git a/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/endpoint/NacosConfigEndpoint.java b/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/endpoint/NacosConfigEndpoint.java
index b0134e77..34ddd2a0 100644
--- a/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/endpoint/NacosConfigEndpoint.java
+++ b/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/endpoint/NacosConfigEndpoint.java
@@ -16,13 +16,6 @@
package org.springframework.cloud.alibaba.nacos.endpoint;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
@@ -30,6 +23,13 @@ import org.springframework.cloud.alibaba.nacos.NacosPropertySourceRepository;
import org.springframework.cloud.alibaba.nacos.client.NacosPropertySource;
import org.springframework.cloud.alibaba.nacos.refresh.NacosRefreshHistory;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Endpoint for Nacos, contains config data and refresh history
* @author xiaojing
diff --git a/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/discovery/NacosWatch.java b/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/discovery/NacosWatch.java
index 0eefaf1a..861dc400 100644
--- a/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/discovery/NacosWatch.java
+++ b/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/discovery/NacosWatch.java
@@ -118,57 +118,10 @@ public class NacosWatch implements ApplicationEventPublisherAware, SmartLifecycl
}
public void nacosServicesWatch() {
- try {
- boolean changed = false;
- NamingService namingService = properties.namingServiceInstance();
+ // nacos doesn't support watch now , publish an event every 30 seconds.
+ this.publisher.publishEvent(
+ new HeartbeatEvent(this, nacosWatchIndex.getAndIncrement()));
- ListView listView = properties.namingServiceInstance()
- .getServicesOfServer(1, Integer.MAX_VALUE);
-
- List serviceList = listView.getData();
-
- // if there are new services found, publish event
- Set currentServices = new HashSet<>(serviceList);
- currentServices.removeAll(cacheServices);
- if (currentServices.size() > 0) {
- changed = true;
- }
-
- // if some services disappear, publish event
- if (cacheServices.removeAll(new HashSet<>(serviceList))
- && cacheServices.size() > 0) {
- changed = true;
-
- for (String serviceName : cacheServices) {
- namingService.unsubscribe(serviceName,
- subscribeListeners.get(serviceName));
- subscribeListeners.remove(serviceName);
- }
- }
-
- cacheServices = new HashSet<>(serviceList);
-
- // subscribe services's node change, publish event if nodes changed
- for (String serviceName : cacheServices) {
- if (!subscribeListeners.containsKey(serviceName)) {
- EventListener eventListener = event -> NacosWatch.this.publisher
- .publishEvent(new HeartbeatEvent(NacosWatch.this,
- nacosWatchIndex.getAndIncrement()));
- subscribeListeners.put(serviceName, eventListener);
- namingService.subscribe(serviceName, eventListener);
-
- }
- }
-
- if (changed) {
- this.publisher.publishEvent(
- new HeartbeatEvent(this, nacosWatchIndex.getAndIncrement()));
- }
-
- }
- catch (Exception e) {
- log.error("Error watching Nacos Service change", e);
- }
}
}
diff --git a/spring-cloud-alibaba-seata/pom.xml b/spring-cloud-alibaba-seata/pom.xml
index fc47ef2c..4d4570ba 100644
--- a/spring-cloud-alibaba-seata/pom.xml
+++ b/spring-cloud-alibaba-seata/pom.xml
@@ -16,8 +16,8 @@
- com.alibaba.fescar
- fescar-spring
+ io.seata
+ seata-spring
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/GlobalTransactionAutoConfiguration.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/GlobalTransactionAutoConfiguration.java
index 1c0abc2d..c02f2d2d 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/GlobalTransactionAutoConfiguration.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/GlobalTransactionAutoConfiguration.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.alibaba.seata;
-import com.alibaba.fescar.spring.annotation.GlobalTransactionScanner;
+import io.seata.spring.annotation.GlobalTransactionScanner;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClient.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClient.java
index 79d305c4..9f4f2fb2 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClient.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClient.java
@@ -23,13 +23,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.alibaba.fescar.core.context.RootContext;
-
-import org.springframework.beans.factory.BeanFactory;
-
import feign.Client;
import feign.Request;
import feign.Response;
+import io.seata.core.context.RootContext;
+import org.springframework.beans.factory.BeanFactory;
import org.springframework.util.StringUtils;
/**
@@ -37,49 +35,49 @@ import org.springframework.util.StringUtils;
*/
public class SeataFeignClient implements Client {
- private final Client delegate;
- private final BeanFactory beanFactory;
+ private final Client delegate;
+ private final BeanFactory beanFactory;
+ private static final int MAP_SIZE = 16;
- SeataFeignClient(BeanFactory beanFactory) {
- this.beanFactory = beanFactory;
- this.delegate = new Client.Default(null, null);
- }
+ SeataFeignClient(BeanFactory beanFactory) {
+ this.beanFactory = beanFactory;
+ this.delegate = new Client.Default(null, null);
+ }
- SeataFeignClient(BeanFactory beanFactory, Client delegate) {
- this.delegate = delegate;
- this.beanFactory = beanFactory;
- }
+ SeataFeignClient(BeanFactory beanFactory, Client delegate) {
+ this.delegate = delegate;
+ this.beanFactory = beanFactory;
+ }
- @Override
- public Response execute(Request request, Request.Options options) throws IOException {
+ @Override
+ public Response execute(Request request, Request.Options options) throws IOException {
- Request modifiedRequest = getModifyRequest(request);
+ Request modifiedRequest = getModifyRequest(request);
- try {
- return this.delegate.execute(modifiedRequest, options);
- }
- finally {
+ try {
+ return this.delegate.execute(modifiedRequest, options);
+ } finally {
- }
- }
+ }
+ }
- private Request getModifyRequest(Request request) {
+ private Request getModifyRequest(Request request) {
- String xid = RootContext.getXID();
+ String xid = RootContext.getXID();
- if (StringUtils.isEmpty(xid)) {
- return request;
- }
+ if (StringUtils.isEmpty(xid)) {
+ return request;
+ }
- Map> headers = new HashMap<>();
- headers.putAll(request.headers());
+ Map> headers = new HashMap<>(MAP_SIZE);
+ headers.putAll(request.headers());
- List fescarXid = new ArrayList<>();
- fescarXid.add(xid);
- headers.put(RootContext.KEY_XID, fescarXid);
+ List fescarXid = new ArrayList<>();
+ fescarXid.add(xid);
+ headers.put(RootContext.KEY_XID, fescarXid);
- return Request.create(request.method(), request.url(), headers, request.body(),
- request.charset());
- }
+ return Request.create(request.method(), request.url(), headers, request.body(),
+ request.charset());
+ }
}
\ No newline at end of file
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClientAutoConfiguration.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClientAutoConfiguration.java
index c3a24f79..5440dc73 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClientAutoConfiguration.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/SeataFeignClientAutoConfiguration.java
@@ -65,19 +65,19 @@ public class SeataFeignClientAutoConfiguration {
protected static class FeignBeanPostProcessorConfiguration {
@Bean
- SeataBeanPostProcessor fescarBeanPostProcessor(
+ SeataBeanPostProcessor seataBeanPostProcessor(
SeataFeignObjectWrapper seataFeignObjectWrapper) {
return new SeataBeanPostProcessor(seataFeignObjectWrapper);
}
@Bean
- SeataContextBeanPostProcessor fescarContextBeanPostProcessor(
+ SeataContextBeanPostProcessor seataContextBeanPostProcessor(
BeanFactory beanFactory) {
return new SeataContextBeanPostProcessor(beanFactory);
}
@Bean
- SeataFeignObjectWrapper fescarFeignObjectWrapper(BeanFactory beanFactory) {
+ SeataFeignObjectWrapper seataFeignObjectWrapper(BeanFactory beanFactory) {
return new SeataFeignObjectWrapper(beanFactory);
}
}
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixAutoConfiguration.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixAutoConfiguration.java
index 332293d1..686acb05 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixAutoConfiguration.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixAutoConfiguration.java
@@ -30,7 +30,7 @@ import com.netflix.hystrix.HystrixCommand;
public class SeataHystrixAutoConfiguration {
@Bean
- SeataHystrixConcurrencyStrategy fescarHystrixConcurrencyStrategy() {
+ SeataHystrixConcurrencyStrategy seataHystrixConcurrencyStrategy() {
return new SeataHystrixConcurrencyStrategy();
}
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java
index 47bd7071..349447b8 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java
@@ -17,7 +17,7 @@ package org.springframework.cloud.alibaba.seata.feign.hystrix;
import java.util.concurrent.Callable;
-import com.alibaba.fescar.core.context.RootContext;
+import io.seata.core.context.RootContext;
import com.netflix.hystrix.strategy.HystrixPlugins;
import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
@@ -37,7 +37,7 @@ public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
@Override
public Callable wrapCallable(Callable c) {
- if (c instanceof FescarContextCallable) {
+ if (c instanceof SeataContextCallable) {
return c;
}
@@ -48,19 +48,19 @@ public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
else {
wrappedCallable = c;
}
- if (wrappedCallable instanceof FescarContextCallable) {
+ if (wrappedCallable instanceof SeataContextCallable) {
return wrappedCallable;
}
- return new FescarContextCallable<>(wrappedCallable);
+ return new SeataContextCallable<>(wrappedCallable);
}
- private static class FescarContextCallable implements Callable {
+ private static class SeataContextCallable implements Callable {
private final Callable actual;
private final String xid;
- FescarContextCallable(Callable actual) {
+ SeataContextCallable(Callable actual) {
this.actual = actual;
this.xid = RootContext.getXID();
}
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateAutoConfiguration.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateAutoConfiguration.java
index 9acad5a0..c08a55ad 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateAutoConfiguration.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateAutoConfiguration.java
@@ -50,7 +50,7 @@ import java.util.List;
public class SeataRestTemplateAutoConfiguration {
@Bean
- public SeataRestTemplateInterceptor fescarRestTemplateInterceptor() {
+ public SeataRestTemplateInterceptor seataRestTemplateInterceptor() {
return new SeataRestTemplateInterceptor();
}
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateInterceptor.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateInterceptor.java
index 1f4bb6f8..b353235c 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateInterceptor.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/rest/SeataRestTemplateInterceptor.java
@@ -18,7 +18,7 @@ package org.springframework.cloud.alibaba.seata.rest;
import java.io.IOException;
-import com.alibaba.fescar.core.context.RootContext;
+import io.seata.core.context.RootContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
diff --git a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/web/SeataHandlerInterceptor.java b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/web/SeataHandlerInterceptor.java
index 640a5605..ed1db9a1 100644
--- a/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/web/SeataHandlerInterceptor.java
+++ b/spring-cloud-alibaba-seata/src/main/java/org/springframework/cloud/alibaba/seata/web/SeataHandlerInterceptor.java
@@ -19,7 +19,7 @@ package org.springframework.cloud.alibaba.seata.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.alibaba.fescar.core.context.RootContext;
+import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,10 +29,10 @@ import org.springframework.web.servlet.HandlerInterceptor;
/**
* @author xiaojing
*
- * Fescar HandlerInterceptor, Convert Fescar information into
- * @see com.alibaba.fescar.core.context.RootContext from http request's header in
+ * Seata HandlerInterceptor, Convert Seata information into
+ * @see io.seata.core.context.RootContext from http request's header in
* {@link org.springframework.web.servlet.HandlerInterceptor#preHandle(HttpServletRequest , HttpServletResponse , Object )},
- * And clean up Fescar information after servlet method invocation in
+ * And clean up Seata information after servlet method invocation in
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
*/
public class SeataHandlerInterceptor implements HandlerInterceptor {
@@ -42,7 +42,7 @@ public class SeataHandlerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
- Object handler) throws Exception {
+ Object handler) {
String xid = RootContext.getXID();
String rpcXid = request.getHeader(RootContext.KEY_XID);
@@ -61,7 +61,7 @@ public class SeataHandlerInterceptor implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
- Object handler, Exception e) throws Exception {
+ Object handler, Exception e) {
String rpcXid = request.getHeader(RootContext.KEY_XID);
diff --git a/spring-cloud-alicloud-acm/src/main/java/org/springframework/cloud/alicloud/acm/endpoint/AcmEndpoint.java b/spring-cloud-alicloud-acm/src/main/java/org/springframework/cloud/alicloud/acm/endpoint/AcmEndpoint.java
index 6160a5f6..6952fa89 100644
--- a/spring-cloud-alicloud-acm/src/main/java/org/springframework/cloud/alicloud/acm/endpoint/AcmEndpoint.java
+++ b/spring-cloud-alicloud-acm/src/main/java/org/springframework/cloud/alicloud/acm/endpoint/AcmEndpoint.java
@@ -16,13 +16,6 @@
package org.springframework.cloud.alicloud.acm.endpoint;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.cloud.alicloud.acm.AcmPropertySourceRepository;
@@ -30,6 +23,13 @@ import org.springframework.cloud.alicloud.acm.bootstrap.AcmPropertySource;
import org.springframework.cloud.alicloud.acm.refresh.AcmRefreshHistory;
import org.springframework.cloud.alicloud.context.acm.AcmProperties;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Created on 01/10/2017.
*
diff --git a/spring-cloud-alicloud-context/src/main/java/org/springframework/cloud/alicloud/context/sms/SmsProperties.java b/spring-cloud-alicloud-context/src/main/java/org/springframework/cloud/alicloud/context/sms/SmsProperties.java
index 33577863..11ba8cb7 100644
--- a/spring-cloud-alicloud-context/src/main/java/org/springframework/cloud/alicloud/context/sms/SmsProperties.java
+++ b/spring-cloud-alicloud-context/src/main/java/org/springframework/cloud/alicloud/context/sms/SmsProperties.java
@@ -12,12 +12,12 @@ public class SmsProperties {
/**
* Product name.
*/
- public static final String smsProduct = "Dysmsapi";
+ public static final String SMS_PRODUCT = "Dysmsapi";
/**
* Product domain.
*/
- public static final String smsDomain = "dysmsapi.aliyuncs.com";
+ public static final String SMS_DOMAIN = "dysmsapi.aliyuncs.com";
/**
* Report queue name.
diff --git a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/SmsInitializerEventListener.java b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/SmsInitializerEventListener.java
index 78253878..4133d498 100644
--- a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/SmsInitializerEventListener.java
+++ b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/SmsInitializerEventListener.java
@@ -60,7 +60,7 @@ public class SmsInitializerEventListener
// 初始化acsClient,暂不支持region化
try {
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou",
- SmsProperties.smsProduct, SmsProperties.smsDomain);
+ SmsProperties.SMS_PRODUCT, SmsProperties.SMS_DOMAIN);
Collection messageListeners = event.getApplicationContext()
.getBeansOfType(MessageListener.class).values();
if (messageListeners.isEmpty()) {
diff --git a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/DefaultAlicomMessagePuller.java b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/DefaultAlicomMessagePuller.java
index df03a071..4d23ccff 100755
--- a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/DefaultAlicomMessagePuller.java
+++ b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/DefaultAlicomMessagePuller.java
@@ -85,8 +85,8 @@ public class DefaultAlicomMessagePuller {
this.executorService = executorService;
}
- protected static final Map sLockObjMap = new HashMap();
- protected static Map sPollingMap = new ConcurrentHashMap();
+ protected static final Map S_LOCK_OBJ_MAP = new HashMap<>();
+ protected static Map sPollingMap = new ConcurrentHashMap<>();
protected Object lockObj;
public boolean setPolling(String queueName) {
@@ -309,11 +309,11 @@ public class DefaultAlicomMessagePuller {
task.messageType = messageType;
task.queueName = queueName;
- synchronized (sLockObjMap) {
- lockObj = sLockObjMap.get(queueName);
+ synchronized (S_LOCK_OBJ_MAP) {
+ lockObj = S_LOCK_OBJ_MAP.get(queueName);
if (lockObj == null) {
lockObj = new Object();
- sLockObjMap.put(queueName, lockObj);
+ S_LOCK_OBJ_MAP.put(queueName, lockObj);
}
}
@@ -355,11 +355,11 @@ public class DefaultAlicomMessagePuller {
task.messageType = messageType;
task.queueName = queueName;
- synchronized (sLockObjMap) {
- lockObj = sLockObjMap.get(queueName);
+ synchronized (S_LOCK_OBJ_MAP) {
+ lockObj = S_LOCK_OBJ_MAP.get(queueName);
if (lockObj == null) {
lockObj = new Object();
- sLockObjMap.put(queueName, lockObj);
+ S_LOCK_OBJ_MAP.put(queueName, lockObj);
}
}
@@ -402,11 +402,11 @@ public class DefaultAlicomMessagePuller {
task.messageType = messageType;
task.queueName = queueName;
- synchronized (sLockObjMap) {
- lockObj = sLockObjMap.get(queueName);
+ synchronized (S_LOCK_OBJ_MAP) {
+ lockObj = S_LOCK_OBJ_MAP.get(queueName);
if (lockObj == null) {
lockObj = new Object();
- sLockObjMap.put(queueName, lockObj);
+ S_LOCK_OBJ_MAP.put(queueName, lockObj);
}
}
diff --git a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueRequest.java b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueRequest.java
index 956ecadb..1de389ca 100644
--- a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueRequest.java
+++ b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueRequest.java
@@ -76,6 +76,7 @@ public class QueryTokenForMnsQueueRequest
}
+ @Override
public Class getResponseClass() {
return QueryTokenForMnsQueueResponse.class;
}
diff --git a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueResponse.java b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueResponse.java
index 56c40171..5e296ed6 100644
--- a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueResponse.java
+++ b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/QueryTokenForMnsQueueResponse.java
@@ -60,6 +60,7 @@ public class QueryTokenForMnsQueueResponse extends AcsResponse {
this.messageTokenDTO = messageTokenDTO;
}
+ @Override
public QueryTokenForMnsQueueResponse getInstance(UnmarshallerContext context) {
return QueryTokenForMnsQueueResponseUnmarshaller.unmarshall(this, context);
}
diff --git a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/TokenGetterForAlicom.java b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/TokenGetterForAlicom.java
index e312ec36..3daf1c83 100755
--- a/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/TokenGetterForAlicom.java
+++ b/spring-cloud-alicloud-sms/src/main/java/org/springframework/cloud/alicloud/sms/base/TokenGetterForAlicom.java
@@ -50,7 +50,7 @@ public class TokenGetterForAlicom {
private String domainForPop;
private IAcsClient iAcsClient;
private Long ownerId;
- private final static String productName = "Dybaseapi";
+ private final static String PRODUCT_NAME = "Dybaseapi";
private long bufferTime = 1000 * 60 * 2;// 过期时间小于2分钟则重新获取,防止服务器时间误差
private final Object lock = new Object();
private ConcurrentMap tokenMap = new ConcurrentHashMap();
@@ -68,7 +68,7 @@ public class TokenGetterForAlicom {
}
private void init() throws ClientException {
- DefaultProfile.addEndpoint(endpointNameForPop, regionIdForPop, productName,
+ DefaultProfile.addEndpoint(endpointNameForPop, regionIdForPop, PRODUCT_NAME,
domainForPop);
IClientProfile profile = DefaultProfile.getProfile(regionIdForPop, accessKeyId,
accessKeySecret);