From 851e0f900dab971f5685cf70ce157fc7e96a7aca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?=
<15040126243@163.com>
Date: Tue, 31 May 2022 19:08:41 +0800
Subject: [PATCH] =?UTF-8?q?add=20=E5=8D=87=E7=BA=A7=20Seata=201.5.X=20?=
=?UTF-8?q?=E6=BA=90=E7=A0=81=E9=9B=86=E6=88=90=E6=9C=8D=E5=8A=A1=E7=AB=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/dev/application-common.yml | 2 +-
config/dev/seata-server.properties | 72 +-
docker/deploy.sh | 6 +-
docker/docker-compose.yml | 12 +-
docker/seata/registry.conf | 28 -
ruoyi-common/ruoyi-common-alibaba-bom/pom.xml | 2 +-
ruoyi-common/ruoyi-common-seata/pom.xml | 31 +-
...acheDubboTransactionPropagationFilter.java | 107 +++
ruoyi-visual/pom.xml | 1 +
ruoyi-visual/ruoyi-seata-server/Dockerfile | 18 +
ruoyi-visual/ruoyi-seata-server/pom.xml | 189 +++++
.../server/AbstractTCInboundHandler.java | 345 ++++++++
.../java/io/seata/server/ParameterParser.java | 214 +++++
.../seata/server/SeataServerApplication.java | 32 +
.../src/main/java/io/seata/server/Server.java | 95 +++
.../server/ServerApplicationListener.java | 136 +++
.../java/io/seata/server/ServerRunner.java | 82 ++
.../java/io/seata/server/UUIDGenerator.java | 51 ++
.../server/auth/AbstractCheckAuthHandler.java | 53 ++
.../server/auth/DefaultCheckAuthHandler.java | 37 +
.../controller/BranchSessionController.java | 35 +
.../controller/GlobalLockController.java | 51 ++
.../controller/GlobalSessionController.java | 50 ++
.../impl/db/BranchSessionDBServiceImpl.java | 102 +++
.../impl/db/GlobalLockDBServiceImpl.java | 146 ++++
.../impl/db/GlobalSessionDBServiceImpl.java | 161 ++++
.../file/BranchSessionFileServiceImpl.java | 39 +
.../impl/file/GlobalLockFileServiceImpl.java | 171 ++++
.../file/GlobalSessionFileServiceImpl.java | 102 +++
.../redis/BranchSessionRedisServiceImpl.java | 64 ++
.../redis/GlobalLockRedisServiceImpl.java | 119 +++
.../redis/GlobalSessionRedisServiceImpl.java | 108 +++
.../server/console/param/GlobalLockParam.java | 114 +++
.../console/param/GlobalSessionParam.java | 102 +++
.../console/service/BranchSessionService.java | 34 +
.../console/service/GlobalLockService.java | 37 +
.../console/service/GlobalSessionService.java | 35 +
.../server/console/vo/BranchSessionVO.java | 241 ++++++
.../seata/server/console/vo/GlobalLockVO.java | 196 +++++
.../server/console/vo/GlobalSessionVO.java | 217 +++++
.../server/controller/HealthController.java | 43 +
.../server/coordinator/AbstractCore.java | 244 ++++++
.../io/seata/server/coordinator/Core.java | 59 ++
.../coordinator/DefaultCoordinator.java | 624 ++++++++++++++
.../seata/server/coordinator/DefaultCore.java | 392 +++++++++
.../TransactionCoordinatorInbound.java | 29 +
.../TransactionCoordinatorOutbound.java | 54 ++
.../io/seata/server/env/ContainerHelper.java | 103 +++
.../java/io/seata/server/env/PortHelper.java | 134 +++
.../seata/server/event/EventBusManager.java | 34 +
.../server/lock/AbstractLockManager.java | 197 +++++
.../io/seata/server/lock/LockManager.java | 106 +++
.../server/lock/LockerManagerFactory.java | 73 ++
.../distributed/DistributedLockerFactory.java | 69 ++
.../SystemPropertyLoggerContextListener.java | 75 ++
...ndedWhitespaceThrowableProxyConverter.java | 36 +
.../appender/EnhancedLogstashEncoder.java | 45 +
.../server/metrics/MeterIdConstants.java | 108 +++
.../seata/server/metrics/MetricsManager.java | 63 ++
.../server/metrics/MetricsPublisher.java | 98 +++
.../server/metrics/MetricsSubscriber.java | 217 +++++
.../session/AbstractSessionManager.java | 199 +++++
.../seata/server/session/BranchSession.java | 469 ++++++++++
.../server/session/BranchSessionHandler.java | 39 +
.../seata/server/session/GlobalSession.java | 776 +++++++++++++++++
.../server/session/GlobalSessionHandler.java | 36 +
.../io/seata/server/session/Lockable.java | 42 +
.../io/seata/server/session/Reloadable.java | 29 +
.../server/session/SessionCondition.java | 144 ++++
.../seata/server/session/SessionHelper.java | 294 +++++++
.../seata/server/session/SessionHolder.java | 424 ++++++++++
.../server/session/SessionLifecycle.java | 89 ++
.../session/SessionLifecycleListener.java | 98 +++
.../seata/server/session/SessionManager.java | 125 +++
.../server/storage/SessionConverter.java | 210 +++++
.../db/lock/DataBaseDistributedLocker.java | 254 ++++++
.../storage/db/lock/DataBaseLockManager.java | 77 ++
.../storage/db/lock/DataBaseLocker.java | 143 ++++
.../storage/db/lock/LockStoreDataBaseDAO.java | 436 ++++++++++
.../db/session/DataBaseSessionManager.java | 193 +++++
.../DataBaseTransactionStoreManager.java | 255 ++++++
.../storage/db/store/LogStoreDataBaseDAO.java | 605 +++++++++++++
.../server/storage/file/FlushDiskMode.java | 43 +
.../server/storage/file/ReloadableStore.java | 45 +
.../storage/file/TransactionWriteStore.java | 129 +++
.../storage/file/lock/FileLockManager.java | 60 ++
.../server/storage/file/lock/FileLocker.java | 221 +++++
.../file/session/FileSessionManager.java | 379 +++++++++
.../store/FileTransactionStoreManager.java | 653 ++++++++++++++
.../storage/redis/JedisPooledFactory.java | 132 +++
.../redis/lock/RedisDistributedLocker.java | 88 ++
.../storage/redis/lock/RedisLockManager.java | 66 ++
.../storage/redis/lock/RedisLocker.java | 395 +++++++++
.../redis/session/RedisSessionManager.java | 194 +++++
.../store/RedisTransactionStoreManager.java | 799 ++++++++++++++++++
.../AbstractTransactionStoreManager.java | 54 ++
.../server/store/DbcpDataSourceProvider.java | 56 ++
.../server/store/DruidDataSourceProvider.java | 55 ++
.../store/HikariDataSourceProvider.java | 60 ++
.../seata/server/store/SessionStorable.java | 38 +
.../io/seata/server/store/StoreConfig.java | 63 ++
.../server/store/TransactionStoreManager.java | 141 ++++
.../seata/server/transaction/at/ATCore.java | 106 +++
.../server/transaction/saga/SagaCore.java | 229 +++++
.../seata/server/transaction/tcc/TccCore.java | 37 +
.../seata/server/transaction/xa/XACore.java | 48 ++
...io.seata.core.rpc.RegisterCheckAuthHandler | 1 +
.../io.seata.core.store.DistributedLocker | 2 +
.../io.seata.core.store.db.DataSourceProvider | 3 +
.../io.seata.server.coordinator.AbstractCore | 4 +
.../services/io.seata.server.lock.LockManager | 3 +
.../io.seata.server.session.SessionManager | 3 +
.../spring-configuration-metadata.json | 22 +
.../main/resources/META-INF/spring.factories | 2 +
.../src/main/resources/README-zh.md | 32 +
.../src/main/resources/README.md | 33 +
.../src/main/resources/application.yml | 59 ++
.../src/main/resources/banner.txt | 7 +
.../src/main/resources/logback-spring.xml | 61 ++
.../resources/logback/console-appender.xml | 13 +
.../main/resources/logback/file-appender.xml | 69 ++
.../main/resources/logback/kafka-appender.xml | 34 +
.../resources/logback/logstash-appender.xml | 29 +
.../resources/lua/redislocker/redislock.lua | 52 ++
sql/ry-seata.sql | 7 +-
125 files changed, 15829 insertions(+), 75 deletions(-)
delete mode 100644 docker/seata/registry.conf
create mode 100644 ruoyi-common/ruoyi-common-seata/src/main/java/io/seata/integration/dubbo/ApacheDubboTransactionPropagationFilter.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/Dockerfile
create mode 100644 ruoyi-visual/ruoyi-seata-server/pom.xml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/AbstractTCInboundHandler.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ParameterParser.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/SeataServerApplication.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/Server.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerApplicationListener.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerRunner.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/UUIDGenerator.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/AbstractCheckAuthHandler.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/DefaultCheckAuthHandler.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/BranchSessionController.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalLockController.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/BranchSessionDBServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/GlobalLockDBServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/GlobalSessionDBServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/file/BranchSessionFileServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/file/GlobalLockFileServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/file/GlobalSessionFileServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/redis/BranchSessionRedisServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/redis/GlobalLockRedisServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/redis/GlobalSessionRedisServiceImpl.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/param/GlobalLockParam.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/param/GlobalSessionParam.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/service/BranchSessionService.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/service/GlobalLockService.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/service/GlobalSessionService.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/vo/BranchSessionVO.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/vo/GlobalLockVO.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/vo/GlobalSessionVO.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/controller/HealthController.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/coordinator/AbstractCore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/coordinator/Core.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/coordinator/DefaultCoordinator.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/coordinator/DefaultCore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/coordinator/TransactionCoordinatorInbound.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/coordinator/TransactionCoordinatorOutbound.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/env/ContainerHelper.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/env/PortHelper.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/event/EventBusManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/lock/AbstractLockManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/lock/LockManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/lock/LockerManagerFactory.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/lock/distributed/DistributedLockerFactory.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/logging/listener/SystemPropertyLoggerContextListener.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/logging/logback/ExtendedWhitespaceThrowableProxyConverter.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/logging/logback/appender/EnhancedLogstashEncoder.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/metrics/MeterIdConstants.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/metrics/MetricsManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/metrics/MetricsPublisher.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/metrics/MetricsSubscriber.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/AbstractSessionManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/BranchSession.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/BranchSessionHandler.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/GlobalSession.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/GlobalSessionHandler.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/Lockable.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/Reloadable.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/SessionCondition.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/SessionHelper.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/SessionHolder.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/SessionLifecycle.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/SessionLifecycleListener.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/session/SessionManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/SessionConverter.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/lock/DataBaseDistributedLocker.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/lock/DataBaseLockManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/lock/DataBaseLocker.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/lock/LockStoreDataBaseDAO.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/session/DataBaseSessionManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/store/DataBaseTransactionStoreManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/db/store/LogStoreDataBaseDAO.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/FlushDiskMode.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/ReloadableStore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/TransactionWriteStore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/lock/FileLockManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/lock/FileLocker.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/session/FileSessionManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/file/store/FileTransactionStoreManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/redis/JedisPooledFactory.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/redis/lock/RedisDistributedLocker.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/redis/lock/RedisLockManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/redis/lock/RedisLocker.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/redis/session/RedisSessionManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/storage/redis/store/RedisTransactionStoreManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/AbstractTransactionStoreManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/DbcpDataSourceProvider.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/DruidDataSourceProvider.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/HikariDataSourceProvider.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/SessionStorable.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/StoreConfig.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/store/TransactionStoreManager.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/transaction/at/ATCore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/transaction/saga/SagaCore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/transaction/tcc/TccCore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/transaction/xa/XACore.java
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/services/io.seata.core.rpc.RegisterCheckAuthHandler
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/services/io.seata.core.store.DistributedLocker
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/services/io.seata.core.store.db.DataSourceProvider
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/services/io.seata.server.coordinator.AbstractCore
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/services/io.seata.server.lock.LockManager
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/services/io.seata.server.session.SessionManager
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/spring-configuration-metadata.json
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/META-INF/spring.factories
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/README-zh.md
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/README.md
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/application.yml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/banner.txt
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/logback-spring.xml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/logback/console-appender.xml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/logback/file-appender.xml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/logback/kafka-appender.xml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/logback/logstash-appender.xml
create mode 100644 ruoyi-visual/ruoyi-seata-server/src/main/resources/lua/redislocker/redislock.lua
diff --git a/config/dev/application-common.yml b/config/dev/application-common.yml
index 4e5af6b6..21c79ddb 100644
--- a/config/dev/application-common.yml
+++ b/config/dev/application-common.yml
@@ -289,7 +289,7 @@ seata:
registry:
type: nacos
nacos:
- application: seata-server
+ application: ruoyi-seata-server
server-addr: ${spring.cloud.nacos.server-addr}
group: ${spring.cloud.nacos.discovery.group}
namespace: ${spring.profiles.active}
diff --git a/config/dev/seata-server.properties b/config/dev/seata-server.properties
index af555eb0..4240bae3 100644
--- a/config/dev/seata-server.properties
+++ b/config/dev/seata-server.properties
@@ -3,10 +3,18 @@ service.vgroupMapping.ruoyi-system-group=default
service.vgroupMapping.ruoyi-resource-group=default
service.vgroupMapping.ruoyi-gen-group=default
service.vgroupMapping.ruoyi-job-group=default
+
service.enableDegrade=false
service.disableGlobalTransaction=false
+
+#Transaction storage configuration, only for the server. The file, DB, and redis configuration values are optional.
store.mode=db
+store.lock.mode=db
+store.session.mode=db
+#Used for password encryption
store.publicKey=
+
+#These configurations are required if the `store mode` is `db`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `db`, you can remove the configuration block.
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.cj.jdbc.Driver
@@ -21,6 +29,8 @@ store.db.distributedLockTable=distributed_lock
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000
+
+#Transaction rule configuration, only for the server
server.recovery.committingRetryPeriod=1000
server.recovery.asynCommittingRetryPeriod=1000
server.recovery.rollbackingRetryPeriod=1000
@@ -29,8 +39,32 @@ server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
server.distributedLockExpireTime=10000
+server.xaerNotaRetryTimeout=60000
+server.session.branchAsyncQueueSize=5000
+server.session.enableBranchAsyncRemove=false
+
+#Transaction rule configuration, only for the client
+client.rm.asyncCommitBufferLimit=10000
+client.rm.lock.retryInterval=10
+client.rm.lock.retryTimes=30
+client.rm.lock.retryPolicyBranchRollbackOnConflict=true
+client.rm.reportRetryCount=5
+client.rm.tableMetaCheckEnable=true
+client.rm.tableMetaCheckerInterval=60000
+client.rm.sqlParserType=druid
+client.rm.reportSuccessEnable=false
+client.rm.sagaBranchRegisterEnable=false
+client.rm.sagaJsonParser=fastjson
+client.rm.tccActionInterceptorOrder=-2147482648
+client.tm.commitRetryCount=5
+client.tm.rollbackRetryCount=5
+client.tm.defaultGlobalTransactionTimeout=60000
+client.tm.degradeCheck=false
+client.tm.degradeCheckAllowTimes=10
+client.tm.degradeCheckPeriod=2000
+client.tm.interceptorOrder=-2147482648
client.undo.dataValidation=true
-client.undo.logSerialization=kryo
+client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
@@ -38,12 +72,40 @@ client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
+
+#For TCC transaction mode
+tcc.fence.logTableName=tcc_fence_log
+tcc.fence.cleanPeriod=1h
+
+#Log rule configuration, for client and server
log.exceptionRate=100
-transport.serialization=seata
-transport.compressor=none
+
+#Metrics configuration, only for the server
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898
-tcc.fence.logTableName=tcc_fence_log
-tcc.fence.cleanPeriod=1h
+
+#For details about configuration items, see https://seata.io/zh-cn/docs/user/configurations.html
+#Transport configuration, for client and server
+transport.type=TCP
+transport.server=NIO
+transport.heartbeat=true
+transport.enableTmClientBatchSendRequest=false
+transport.enableRmClientBatchSendRequest=true
+transport.enableTcServerBatchSendResponse=false
+transport.rpcRmRequestTimeout=30000
+transport.rpcTmRequestTimeout=30000
+transport.rpcTcRequestTimeout=30000
+transport.threadFactory.bossThreadPrefix=NettyBoss
+transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
+transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
+transport.threadFactory.shareBossWorker=false
+transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
+transport.threadFactory.clientSelectorThreadSize=1
+transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
+transport.threadFactory.bossThreadSize=1
+transport.threadFactory.workerThreadSize=default
+transport.shutdown.wait=3
+transport.serialization=seata
+transport.compressor=none
diff --git a/docker/deploy.sh b/docker/deploy.sh
index cda05be2..54bcd6e2 100644
--- a/docker/deploy.sh
+++ b/docker/deploy.sh
@@ -27,6 +27,7 @@ port(){
# sentinel端口
firewall-cmd --add-port=8718/tcp --permanent
# seata端口
+ firewall-cmd --add-port=7091/tcp --permanent
firewall-cmd --add-port=8091/tcp --permanent
# 重启防火墙
service firewalld restart
@@ -49,11 +50,6 @@ mount(){
mkdir -p /docker/nacos/conf
cp nacos/custom.properties /docker/nacos/conf/custom.properties
fi
- #挂载 seata 配置文件
- if test ! -f "/docker/seata/conf/registry.conf" ;then
- mkdir -p /docker/seata/conf
- cp seata/registry.conf /docker/seata/conf/registry.conf
- fi
}
#启动基础模块
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 2c56aee2..4842e011 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -113,24 +113,22 @@ services:
ipv4_address: 172.30.0.54
seata-server:
- image: seataio/seata-server:1.4.2
+ image: ruoyi/ruoyi-seata-server:0.11.0
container_name: seata-server
ports:
+ - "7091:7091"
- "8091:8091"
environment:
TZ: Asia/Shanghai
# 注意 此处ip如果是外网使用 要改为外网ip
- SEATA_IP: 172.30.0.58
+ # SEATA_IP: 127.0.0.1
SEATA_PORT: 8091
- STORE_MODE: db
- SEATA_CONFIG_NAME: file:/root/seata-config/registry
volumes:
- - /docker/seata/config:/root/seata-config
+ - /docker/ruoyi-seata-server/logs/:/ruoyi/seata-server/logs
privileged: true
restart: always
networks:
- ruoyi_net:
- ipv4_address: 172.30.0.58
+ - ruoyi_net
nginx-web:
image: nginx:1.21.3
diff --git a/docker/seata/registry.conf b/docker/seata/registry.conf
deleted file mode 100644
index 2912ddb7..00000000
--- a/docker/seata/registry.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-registry {
- # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
- type = "nacos"
-
- nacos {
- application = "seata-server"
- serverAddr = "172.30.0.40:8848"
- group = "DEFAULT_GROUP"
- namespace = "dev"
- cluster = "default"
- username = ""
- password = ""
- }
-}
-
-config {
- # file、nacos 、apollo、zk、consul、etcd3
- type = "nacos"
-
- nacos {
- serverAddr = "172.30.0.40:8848"
- group = "DEFAULT_GROUP"
- namespace = "dev"
- username = ""
- password = ""
- dataId = "seata-server.properties"
- }
-}
diff --git a/ruoyi-common/ruoyi-common-alibaba-bom/pom.xml b/ruoyi-common/ruoyi-common-alibaba-bom/pom.xml
index ee5ec20e..1c28cb19 100644
--- a/ruoyi-common/ruoyi-common-alibaba-bom/pom.xml
+++ b/ruoyi-common/ruoyi-common-alibaba-bom/pom.xml
@@ -22,7 +22,7 @@
2.2.1
1.1.0
2.0.2
- 1.4.2
+ 1.5.1
3.0.8
1.0.11
diff --git a/ruoyi-common/ruoyi-common-seata/pom.xml b/ruoyi-common/ruoyi-common-seata/pom.xml
index 9638adcc..d1fa5819 100644
--- a/ruoyi-common/ruoyi-common-seata/pom.xml
+++ b/ruoyi-common/ruoyi-common-seata/pom.xml
@@ -17,36 +17,17 @@
+
+ org.apache.dubbo
+ dubbo
+ true
+
+
com.alibaba.cloud
spring-cloud-starter-alibaba-seata
-
-
- com.google.protobuf
- protobuf-java
- 3.16.1
-
-
-
-
- com.esotericsoftware
- kryo
- 4.0.2
-
-
- asm
- org.ow2.asm
-
-
-
-
- de.javakaffee
- kryo-serializers
- 0.43
-
-
diff --git a/ruoyi-common/ruoyi-common-seata/src/main/java/io/seata/integration/dubbo/ApacheDubboTransactionPropagationFilter.java b/ruoyi-common/ruoyi-common-seata/src/main/java/io/seata/integration/dubbo/ApacheDubboTransactionPropagationFilter.java
new file mode 100644
index 00000000..5fd05da3
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-seata/src/main/java/io/seata/integration/dubbo/ApacheDubboTransactionPropagationFilter.java
@@ -0,0 +1,107 @@
+/*
+ * 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.dubbo;
+
+import io.seata.common.util.StringUtils;
+import io.seata.core.constants.DubboConstants;
+import io.seata.core.context.RootContext;
+import io.seata.core.model.BranchType;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The type Transaction propagation filter.
+ *
+ * @author sharajava
+ */
+@Activate(group = {DubboConstants.PROVIDER, DubboConstants.CONSUMER}, order = 100)
+public class ApacheDubboTransactionPropagationFilter implements Filter {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ApacheDubboTransactionPropagationFilter.class);
+
+ @Override
+ public Result invoke(Invoker> invoker, Invocation invocation) throws RpcException {
+ String xid = RootContext.getXID();
+ BranchType branchType = RootContext.getBranchType();
+
+ String rpcXid = getRpcXid();
+ String rpcBranchType = RpcContext.getServiceContext().getAttachment(RootContext.KEY_BRANCH_TYPE);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("xid in RootContext[{}] xid in RpcContext[{}]", xid, rpcXid);
+ }
+ boolean bind = false;
+ if (xid != null) {
+ RpcContext.getServiceContext().setAttachment(RootContext.KEY_XID, xid);
+ RpcContext.getServiceContext().setAttachment(RootContext.KEY_BRANCH_TYPE, branchType.name());
+ } else {
+ if (rpcXid != null) {
+ RootContext.bind(rpcXid);
+ if (StringUtils.equals(BranchType.TCC.name(), rpcBranchType)) {
+ RootContext.bindBranchType(BranchType.TCC);
+ }
+ bind = true;
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("bind xid [{}] branchType [{}] to RootContext", rpcXid, rpcBranchType);
+ }
+ }
+ }
+ try {
+ return invoker.invoke(invocation);
+ } finally {
+ if (bind) {
+ BranchType previousBranchType = RootContext.getBranchType();
+ String unbindXid = RootContext.unbind();
+ if (BranchType.TCC == previousBranchType) {
+ RootContext.unbindBranchType();
+ }
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("unbind xid [{}] branchType [{}] from RootContext", unbindXid, previousBranchType);
+ }
+ if (!rpcXid.equalsIgnoreCase(unbindXid)) {
+ LOGGER.warn("xid in change during RPC from {} to {},branchType from {} to {}", rpcXid, unbindXid,
+ rpcBranchType != null ? rpcBranchType : "AT", previousBranchType);
+ if (unbindXid != null) {
+ RootContext.bind(unbindXid);
+ LOGGER.warn("bind xid [{}] back to RootContext", unbindXid);
+ if (BranchType.TCC == previousBranchType) {
+ RootContext.bindBranchType(BranchType.TCC);
+ LOGGER.warn("bind branchType [{}] back to RootContext", previousBranchType);
+ }
+ }
+ }
+ }
+ RpcContext.getServiceContext().removeAttachment(RootContext.KEY_XID);
+ RpcContext.getServiceContext().removeAttachment(RootContext.KEY_BRANCH_TYPE);
+ RpcContext.getServerContext().removeAttachment(RootContext.KEY_XID);
+ RpcContext.getServerContext().removeAttachment(RootContext.KEY_BRANCH_TYPE);
+ }
+ }
+
+ /**
+ * get rpc xid
+ * @return
+ */
+ private String getRpcXid() {
+ String rpcXid = RpcContext.getServiceContext().getAttachment(RootContext.KEY_XID);
+ if (rpcXid == null) {
+ rpcXid = RpcContext.getServiceContext().getAttachment(RootContext.KEY_XID.toLowerCase());
+ }
+ return rpcXid;
+ }
+
+}
diff --git a/ruoyi-visual/pom.xml b/ruoyi-visual/pom.xml
index 80eea5ba..0ea35c80 100644
--- a/ruoyi-visual/pom.xml
+++ b/ruoyi-visual/pom.xml
@@ -13,6 +13,7 @@
ruoyi-xxl-job-admin
ruoyi-doc
ruoyi-sentinel-dashboard
+ ruoyi-seata-server
ruoyi-visual
diff --git a/ruoyi-visual/ruoyi-seata-server/Dockerfile b/ruoyi-visual/ruoyi-seata-server/Dockerfile
new file mode 100644
index 00000000..a0455e85
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/Dockerfile
@@ -0,0 +1,18 @@
+FROM anapsix/alpine-java:8_server-jre_unlimited
+
+MAINTAINER Lion Li
+
+RUN mkdir -p /ruoyi/seata-server
+RUN mkdir -p /ruoyi/seata-server/logs
+
+WORKDIR /ruoyi/seata-server
+
+ENV TZ=PRC
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+EXPOSE 7091
+EXPOSE 8091
+
+ADD ./target/ruoyi-seata-server.jar ./app.jar
+
+ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
diff --git a/ruoyi-visual/ruoyi-seata-server/pom.xml b/ruoyi-visual/ruoyi-seata-server/pom.xml
new file mode 100644
index 00000000..0bc089c6
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/pom.xml
@@ -0,0 +1,189 @@
+
+
+
+
+ com.ruoyi
+ ruoyi-visual
+ 0.11.0
+
+ 4.0.0
+ ruoyi-seata-server
+ jar
+
+
+ 1.5.1
+ 1.72
+ 6.5
+ 0.2.0-RC2
+
+
+
+
+
+ io.seata
+ seata-bom
+ ${seata.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ io.seata
+ seata-spring-autoconfigure-server
+ ${seata.version}
+
+
+
+ io.seata
+ seata-core
+
+
+ io.seata
+ seata-config-all
+
+
+ io.seata
+ seata-discovery-all
+
+
+ io.seata
+ seata-serializer-all
+
+
+ io.seata
+ seata-compressor-all
+
+
+
+ io.seata
+ seata-metrics-all
+
+
+
+ io.seata
+ seata-console
+ ${seata.version}
+
+
+
+
+ com.alibaba
+ druid
+ ${druid.version}
+
+
+ org.apache.commons
+ commons-dbcp2
+
+
+ com.zaxxer
+ HikariCP
+
+
+ com.h2database
+ h2
+
+
+ mysql
+ mysql-connector-java
+
+
+ org.postgresql
+ postgresql
+
+
+
+
+ com.beust
+ jcommander
+ ${jcommander.version}
+
+
+
+
+ com.google.guava
+ guava
+
+
+
+
+ redis.clients
+ jedis
+
+
+
+ com.alibaba
+ fastjson
+
+
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
+ net.logstash.logback
+ logstash-logback-encoder
+ ${logstash-logback-encoder.version}
+
+
+ com.github.danielwegener
+ logback-kafka-appender
+ ${kafka-appender.version}
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ repackage
+
+
+
+
+
+ com.spotify
+ docker-maven-plugin
+
+
+
+
+
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/AbstractTCInboundHandler.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/AbstractTCInboundHandler.java
new file mode 100644
index 00000000..18a26990
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/AbstractTCInboundHandler.java
@@ -0,0 +1,345 @@
+/*
+ * 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.server;
+
+import io.seata.common.exception.StoreException;
+import io.seata.core.exception.AbstractExceptionHandler;
+import io.seata.core.exception.TransactionException;
+import io.seata.core.exception.TransactionExceptionCode;
+import io.seata.core.model.GlobalStatus;
+import io.seata.core.protocol.transaction.AbstractGlobalEndRequest;
+import io.seata.core.protocol.transaction.AbstractGlobalEndResponse;
+import io.seata.core.protocol.transaction.BranchRegisterRequest;
+import io.seata.core.protocol.transaction.BranchRegisterResponse;
+import io.seata.core.protocol.transaction.BranchReportRequest;
+import io.seata.core.protocol.transaction.BranchReportResponse;
+import io.seata.core.protocol.transaction.GlobalBeginRequest;
+import io.seata.core.protocol.transaction.GlobalBeginResponse;
+import io.seata.core.protocol.transaction.GlobalCommitRequest;
+import io.seata.core.protocol.transaction.GlobalCommitResponse;
+import io.seata.core.protocol.transaction.GlobalLockQueryRequest;
+import io.seata.core.protocol.transaction.GlobalLockQueryResponse;
+import io.seata.core.protocol.transaction.GlobalReportRequest;
+import io.seata.core.protocol.transaction.GlobalReportResponse;
+import io.seata.core.protocol.transaction.GlobalRollbackRequest;
+import io.seata.core.protocol.transaction.GlobalRollbackResponse;
+import io.seata.core.protocol.transaction.GlobalStatusRequest;
+import io.seata.core.protocol.transaction.GlobalStatusResponse;
+import io.seata.core.protocol.transaction.TCInboundHandler;
+import io.seata.core.rpc.RpcContext;
+import io.seata.server.session.GlobalSession;
+import io.seata.server.session.SessionHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The type Abstract tc inbound handler.
+ *
+ * @author sharajava
+ */
+public abstract class AbstractTCInboundHandler extends AbstractExceptionHandler implements TCInboundHandler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTCInboundHandler.class);
+
+ @Override
+ public GlobalBeginResponse handle(GlobalBeginRequest request, final RpcContext rpcContext) {
+ GlobalBeginResponse response = new GlobalBeginResponse();
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(GlobalBeginRequest request, GlobalBeginResponse response) throws TransactionException {
+ try {
+ doGlobalBegin(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore,
+ String.format("begin global request failed. xid=%s, msg=%s", response.getXid(), e.getMessage()),
+ e);
+ }
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do global begin.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doGlobalBegin(GlobalBeginRequest request, GlobalBeginResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public GlobalCommitResponse handle(GlobalCommitRequest request, final RpcContext rpcContext) {
+ GlobalCommitResponse response = new GlobalCommitResponse();
+ response.setGlobalStatus(GlobalStatus.Committing);
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(GlobalCommitRequest request, GlobalCommitResponse response)
+ throws TransactionException {
+ try {
+ doGlobalCommit(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore,
+ String.format("global commit request failed. xid=%s, msg=%s", request.getXid(), e.getMessage()),
+ e);
+ }
+ }
+ @Override
+ public void onTransactionException(GlobalCommitRequest request, GlobalCommitResponse response,
+ TransactionException tex) {
+ super.onTransactionException(request, response, tex);
+ checkTransactionStatus(request, response);
+ }
+
+ @Override
+ public void onException(GlobalCommitRequest request, GlobalCommitResponse response, Exception rex) {
+ super.onException(request, response, rex);
+ checkTransactionStatus(request, response);
+ }
+
+
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do global commit.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doGlobalCommit(GlobalCommitRequest request, GlobalCommitResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public GlobalRollbackResponse handle(GlobalRollbackRequest request, final RpcContext rpcContext) {
+ GlobalRollbackResponse response = new GlobalRollbackResponse();
+ response.setGlobalStatus(GlobalStatus.Rollbacking);
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(GlobalRollbackRequest request, GlobalRollbackResponse response)
+ throws TransactionException {
+ try {
+ doGlobalRollback(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore, String
+ .format("global rollback request failed. xid=%s, msg=%s", request.getXid(), e.getMessage()), e);
+ }
+ }
+
+ @Override
+ public void onTransactionException(GlobalRollbackRequest request, GlobalRollbackResponse response,
+ TransactionException tex) {
+ super.onTransactionException(request, response, tex);
+ // may be appears StoreException outer layer method catch
+ checkTransactionStatus(request, response);
+ }
+
+ @Override
+ public void onException(GlobalRollbackRequest request, GlobalRollbackResponse response, Exception rex) {
+ super.onException(request, response, rex);
+ // may be appears StoreException outer layer method catch
+ checkTransactionStatus(request, response);
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do global rollback.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doGlobalRollback(GlobalRollbackRequest request, GlobalRollbackResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public BranchRegisterResponse handle(BranchRegisterRequest request, final RpcContext rpcContext) {
+ BranchRegisterResponse response = new BranchRegisterResponse();
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(BranchRegisterRequest request, BranchRegisterResponse response)
+ throws TransactionException {
+ try {
+ doBranchRegister(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore, String
+ .format("branch register request failed. xid=%s, msg=%s", request.getXid(), e.getMessage()), e);
+ }
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do branch register.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doBranchRegister(BranchRegisterRequest request, BranchRegisterResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public BranchReportResponse handle(BranchReportRequest request, final RpcContext rpcContext) {
+ BranchReportResponse response = new BranchReportResponse();
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(BranchReportRequest request, BranchReportResponse response)
+ throws TransactionException {
+ try {
+ doBranchReport(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore, String
+ .format("branch report request failed. xid=%s, branchId=%s, msg=%s", request.getXid(),
+ request.getBranchId(), e.getMessage()), e);
+ }
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do branch report.
+ *
+ * @param request the request
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doBranchReport(BranchReportRequest request, BranchReportResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public GlobalLockQueryResponse handle(GlobalLockQueryRequest request, final RpcContext rpcContext) {
+ GlobalLockQueryResponse response = new GlobalLockQueryResponse();
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(GlobalLockQueryRequest request, GlobalLockQueryResponse response)
+ throws TransactionException {
+ try {
+ doLockCheck(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore, String
+ .format("global lock query request failed. xid=%s, msg=%s", request.getXid(), e.getMessage()),
+ e);
+ }
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do lock check.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doLockCheck(GlobalLockQueryRequest request, GlobalLockQueryResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public GlobalStatusResponse handle(GlobalStatusRequest request, final RpcContext rpcContext) {
+ GlobalStatusResponse response = new GlobalStatusResponse();
+ response.setGlobalStatus(GlobalStatus.UnKnown);
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(GlobalStatusRequest request, GlobalStatusResponse response)
+ throws TransactionException {
+ try {
+ doGlobalStatus(request, response, rpcContext);
+ } catch (StoreException e) {
+ throw new TransactionException(TransactionExceptionCode.FailedStore,
+ String.format("global status request failed. xid=%s, msg=%s", request.getXid(), e.getMessage()),
+ e);
+ }
+ }
+
+ @Override
+ public void onTransactionException(GlobalStatusRequest request, GlobalStatusResponse response,
+ TransactionException tex) {
+ super.onTransactionException(request, response, tex);
+ checkTransactionStatus(request, response);
+ }
+
+ @Override
+ public void onException(GlobalStatusRequest request, GlobalStatusResponse response, Exception rex) {
+ super.onException(request, response, rex);
+ checkTransactionStatus(request, response);
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do global status.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doGlobalStatus(GlobalStatusRequest request, GlobalStatusResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ @Override
+ public GlobalReportResponse handle(GlobalReportRequest request, final RpcContext rpcContext) {
+ GlobalReportResponse response = new GlobalReportResponse();
+ response.setGlobalStatus(request.getGlobalStatus());
+ exceptionHandleTemplate(new AbstractCallback() {
+ @Override
+ public void execute(GlobalReportRequest request, GlobalReportResponse response)
+ throws TransactionException {
+ doGlobalReport(request, response, rpcContext);
+ }
+ }, request, response);
+ return response;
+ }
+
+ /**
+ * Do global report.
+ *
+ * @param request the request
+ * @param response the response
+ * @param rpcContext the rpc context
+ * @throws TransactionException the transaction exception
+ */
+ protected abstract void doGlobalReport(GlobalReportRequest request, GlobalReportResponse response,
+ RpcContext rpcContext) throws TransactionException;
+
+ private void checkTransactionStatus(AbstractGlobalEndRequest request, AbstractGlobalEndResponse response) {
+ try {
+ GlobalSession globalSession = SessionHolder.findGlobalSession(request.getXid(), false);
+ if (globalSession != null) {
+ response.setGlobalStatus(globalSession.getStatus());
+ } else {
+ response.setGlobalStatus(GlobalStatus.Finished);
+ }
+ } catch (Exception exx) {
+ LOGGER.error("check transaction status error,{}]", exx.getMessage());
+ }
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ParameterParser.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ParameterParser.java
new file mode 100644
index 00000000..1305fa99
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ParameterParser.java
@@ -0,0 +1,214 @@
+/*
+ * 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.server;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ParameterException;
+import io.seata.common.util.StringUtils;
+import io.seata.config.Configuration;
+import io.seata.config.ConfigurationFactory;
+import io.seata.core.constants.ConfigurationKeys;
+import io.seata.server.env.ContainerHelper;
+
+import static io.seata.common.DefaultValues.SERVER_DEFAULT_STORE_MODE;
+import static io.seata.config.ConfigurationFactory.ENV_PROPERTY_KEY;
+
+/**
+ * The type Parameter parser.
+ *
+ * @author xingfudeshi @gmail.com
+ */
+public class ParameterParser {
+
+ private static final String PROGRAM_NAME
+ = "sh seata-server.sh(for linux and mac) or cmd seata-server.bat(for windows)";
+
+ private static final Configuration CONFIG = ConfigurationFactory.getInstance();
+
+ @Parameter(names = "--help", help = true)
+ private boolean help;
+ @Parameter(names = {"--host", "-h"}, description = "The ip to register to registry center.", order = 1)
+ private String host;
+ @Parameter(names = {"--port", "-p"}, description = "The port to listen.", order = 2)
+ private int port;
+ @Parameter(names = {"--storeMode", "-m"}, description = "log store mode : file, db, redis", order = 3)
+ private String storeMode;
+ @Parameter(names = {"--serverNode", "-n"}, description = "server node id, such as 1, 2, 3.it will be generated according to the snowflake by default", order = 4)
+ private Long serverNode;
+ @Parameter(names = {"--seataEnv", "-e"}, description = "The name used for multi-configuration isolation.",
+ order = 5)
+ private String seataEnv;
+ @Parameter(names = {"--sessionStoreMode", "-ssm"}, description = "session log store mode : file, db, redis",
+ order = 6)
+ private String sessionStoreMode;
+ @Parameter(names = {"--lockStoreMode", "-lsm"}, description = "lock log store mode : file, db, redis", order = 7)
+ private String lockStoreMode;
+
+ /**
+ * Instantiates a new Parameter parser.
+ *
+ * @param args the args
+ */
+ public ParameterParser(String... args) {
+ this.init(args);
+ }
+
+ private void init(String[] args) {
+ try {
+ getCommandParameters(args);
+ getEnvParameters();
+ if (StringUtils.isNotBlank(seataEnv)) {
+ System.setProperty(ENV_PROPERTY_KEY, seataEnv);
+ }
+ if (StringUtils.isBlank(storeMode)) {
+ storeMode = CONFIG.getConfig(ConfigurationKeys.STORE_MODE, SERVER_DEFAULT_STORE_MODE);
+ }
+ if (StringUtils.isBlank(sessionStoreMode)) {
+ sessionStoreMode = CONFIG.getConfig(ConfigurationKeys.STORE_SESSION_MODE, storeMode);
+ }
+ if (StringUtils.isBlank(lockStoreMode)) {
+ lockStoreMode = CONFIG.getConfig(ConfigurationKeys.STORE_LOCK_MODE, storeMode);
+ }
+ } catch (ParameterException e) {
+ printError(e);
+ }
+
+ }
+
+ private void getCommandParameters(String[] args) {
+ JCommander jCommander = JCommander.newBuilder().addObject(this).build();
+ jCommander.parse(args);
+ if (help) {
+ jCommander.setProgramName(PROGRAM_NAME);
+ jCommander.usage();
+ System.exit(0);
+ }
+ }
+
+ private void getEnvParameters() {
+ if (StringUtils.isBlank(seataEnv)) {
+ seataEnv = ContainerHelper.getEnv();
+ }
+ if (StringUtils.isBlank(host)) {
+ host = ContainerHelper.getHost();
+ }
+ if (port == 0) {
+ port = ContainerHelper.getPort();
+ }
+ if (serverNode == null) {
+ serverNode = ContainerHelper.getServerNode();
+ }
+ if (StringUtils.isBlank(storeMode)) {
+ storeMode = ContainerHelper.getStoreMode();
+ }
+ if (StringUtils.isBlank(sessionStoreMode)) {
+ sessionStoreMode = ContainerHelper.getSessionStoreMode();
+ }
+ if (StringUtils.isBlank(lockStoreMode)) {
+ lockStoreMode = ContainerHelper.getLockStoreMode();
+ }
+ }
+
+ private void printError(ParameterException e) {
+ System.err.println("Option error " + e.getMessage());
+ e.getJCommander().setProgramName(PROGRAM_NAME);
+ e.usage();
+ System.exit(0);
+ }
+
+ /**
+ * Gets host.
+ *
+ * @return the host
+ */
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * Gets port.
+ *
+ * @return the port
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * Gets store mode.
+ *
+ * @return the store mode
+ */
+ public String getStoreMode() {
+ return storeMode;
+ }
+
+ /**
+ * Gets lock store mode.
+ *
+ * @return the store mode
+ */
+ public String getLockStoreMode() {
+ return StringUtils.isNotEmpty(lockStoreMode) ? lockStoreMode : storeMode;
+ }
+
+ /**
+ * Gets session store mode.
+ *
+ * @return the store mode
+ */
+ public String getSessionStoreMode() {
+ return StringUtils.isNotEmpty(sessionStoreMode) ? sessionStoreMode : storeMode;
+ }
+
+ /**
+ * Is help boolean.
+ *
+ * @return the boolean
+ */
+ public boolean isHelp() {
+ return help;
+ }
+
+ /**
+ * Gets server node.
+ *
+ * @return the server node
+ */
+ public Long getServerNode() {
+ return serverNode;
+ }
+
+ /**
+ * Gets seata env
+ *
+ * @return the name used for multi-configuration isolation.
+ */
+ public String getSeataEnv() {
+ return seataEnv;
+ }
+
+ /**
+ * Clean up.
+ */
+ public void cleanUp() {
+ if (null != System.getProperty(ENV_PROPERTY_KEY)) {
+ System.clearProperty(ENV_PROPERTY_KEY);
+ }
+ }
+
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/SeataServerApplication.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/SeataServerApplication.java
new file mode 100644
index 00000000..b8046178
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/SeataServerApplication.java
@@ -0,0 +1,32 @@
+/*
+ * 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.server;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+import java.io.IOException;
+
+/**
+ * @author spilledyear@outlook.com
+ */
+@SpringBootApplication(scanBasePackages = {"io.seata"})
+public class SeataServerApplication {
+ public static void main(String[] args) throws IOException {
+ // run the spring-boot application
+ SpringApplication.run(SeataServerApplication.class, args);
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/Server.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/Server.java
new file mode 100644
index 00000000..1603e9d9
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/Server.java
@@ -0,0 +1,95 @@
+/*
+ * 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.server;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import io.seata.common.XID;
+import io.seata.common.thread.NamedThreadFactory;
+import io.seata.common.util.NetUtil;
+import io.seata.common.util.StringUtils;
+import io.seata.config.ConfigurationFactory;
+import io.seata.core.constants.ConfigurationKeys;
+import io.seata.core.rpc.netty.NettyRemotingServer;
+import io.seata.core.rpc.netty.NettyServerConfig;
+import io.seata.server.coordinator.DefaultCoordinator;
+import io.seata.server.lock.LockerManagerFactory;
+import io.seata.server.metrics.MetricsManager;
+import io.seata.server.session.SessionHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static io.seata.spring.boot.autoconfigure.StarterConstants.REGEX_SPLIT_CHAR;
+import static io.seata.spring.boot.autoconfigure.StarterConstants.REGISTRY_PREFERED_NETWORKS;
+
+/**
+ * The type Server.
+ *
+ * @author slievrly
+ */
+public class Server {
+ /**
+ * The entry point of application.
+ *
+ * @param args the input arguments
+ */
+ public static void start(String[] args) {
+ // create logger
+ final Logger logger = LoggerFactory.getLogger(Server.class);
+
+ //initialize the parameter parser
+ //Note that the parameter parser should always be the first line to execute.
+ //Because, here we need to parse the parameters needed for startup.
+ ParameterParser parameterParser = new ParameterParser(args);
+
+ //initialize the metrics
+ MetricsManager.get().init();
+
+ System.setProperty(ConfigurationKeys.STORE_MODE, parameterParser.getStoreMode());
+
+ ThreadPoolExecutor workingThreads = new ThreadPoolExecutor(NettyServerConfig.getMinServerPoolSize(),
+ NettyServerConfig.getMaxServerPoolSize(), NettyServerConfig.getKeepAliveTime(), TimeUnit.SECONDS,
+ new LinkedBlockingQueue<>(NettyServerConfig.getMaxTaskQueueSize()),
+ new NamedThreadFactory("ServerHandlerThread", NettyServerConfig.getMaxServerPoolSize()), new ThreadPoolExecutor.CallerRunsPolicy());
+
+ NettyRemotingServer nettyRemotingServer = new NettyRemotingServer(workingThreads);
+ UUIDGenerator.init(parameterParser.getServerNode());
+ //log store mode : file, db, redis
+ SessionHolder.init(parameterParser.getSessionStoreMode());
+ LockerManagerFactory.init(parameterParser.getLockStoreMode());
+ DefaultCoordinator coordinator = DefaultCoordinator.getInstance(nettyRemotingServer);
+ coordinator.init();
+ nettyRemotingServer.setHandler(coordinator);
+
+ // let ServerRunner do destroy instead ShutdownHook, see https://github.com/seata/seata/issues/4028
+ ServerRunner.addDisposable(coordinator);
+
+ //127.0.0.1 and 0.0.0.0 are not valid here.
+ if (NetUtil.isValidIp(parameterParser.getHost(), false)) {
+ XID.setIpAddress(parameterParser.getHost());
+ } else {
+ String preferredNetworks = ConfigurationFactory.getInstance().getConfig(REGISTRY_PREFERED_NETWORKS);
+ if (StringUtils.isNotBlank(preferredNetworks)) {
+ XID.setIpAddress(NetUtil.getLocalIp(preferredNetworks.split(REGEX_SPLIT_CHAR)));
+ } else {
+ XID.setIpAddress(NetUtil.getLocalIp());
+ }
+ }
+ nettyRemotingServer.init();
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerApplicationListener.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerApplicationListener.java
new file mode 100644
index 00000000..79c54134
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerApplicationListener.java
@@ -0,0 +1,136 @@
+/*
+ * 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.server;
+
+import java.util.Properties;
+import io.seata.common.holder.ObjectHolder;
+import io.seata.common.util.StringUtils;
+import io.seata.config.Configuration;
+import io.seata.config.ConfigurationFactory;
+import io.seata.spring.boot.autoconfigure.SeataCoreEnvironmentPostProcessor;
+import io.seata.spring.boot.autoconfigure.SeataServerEnvironmentPostProcessor;
+import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
+import org.springframework.boot.context.logging.LoggingApplicationListener;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.event.GenericApplicationListener;
+import org.springframework.core.ResolvableType;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.PropertiesPropertySource;
+
+import static io.seata.common.ConfigurationKeys.STORE_LOCK_MODE;
+import static io.seata.common.ConfigurationKeys.STORE_MODE;
+import static io.seata.common.ConfigurationKeys.STORE_SESSION_MODE;
+import static io.seata.common.Constants.OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT;
+import static io.seata.common.DefaultValues.SERVICE_OFFSET_SPRING_BOOT;
+import static io.seata.core.constants.ConfigurationKeys.ENV_SEATA_PORT_KEY;
+import static io.seata.core.constants.ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL;
+import static io.seata.core.constants.ConfigurationKeys.SERVER_SERVICE_PORT_CONFIG;
+
+/**
+ * @author slievrly
+ * @author funkye
+ */
+public class ServerApplicationListener implements GenericApplicationListener {
+
+ @Override
+ public boolean supportsEventType(ResolvableType eventType) {
+ return eventType.getRawClass() != null
+ && ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(eventType.getRawClass());
+ }
+
+ @Override
+ public void onApplicationEvent(ApplicationEvent event) {
+ if (!(event instanceof ApplicationEnvironmentPreparedEvent)) {
+ return;
+ }
+ ApplicationEnvironmentPreparedEvent environmentPreparedEvent = (ApplicationEnvironmentPreparedEvent)event;
+ ConfigurableEnvironment environment = environmentPreparedEvent.getEnvironment();
+ ObjectHolder.INSTANCE.setObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT, environment);
+ SeataCoreEnvironmentPostProcessor.init();
+ SeataServerEnvironmentPostProcessor.init();
+ Configuration config = ConfigurationFactory.getInstance();
+ // Load by priority
+ System.setProperty("sessionMode",
+ config.getConfig(STORE_SESSION_MODE, config.getConfig(STORE_MODE, "file")));
+ System.setProperty("lockMode",
+ config.getConfig(STORE_LOCK_MODE, config.getConfig(STORE_MODE, "file")));
+
+ String[] args = environmentPreparedEvent.getArgs();
+
+ // port: -p > -D > env > yml > default
+
+ //-p 8091
+ if (args != null && args.length >= 2) {
+ for (int i = 0; i < args.length; ++i) {
+ if ("-p".equalsIgnoreCase(args[i]) && i < args.length - 1) {
+ setTargetPort(environment, args[i + 1], true);
+ return;
+ }
+ }
+ }
+
+ // -Dserver.servicePort=8091
+ String dPort = environment.getProperty(SERVER_SERVICE_PORT_CAMEL, String.class);
+ if (StringUtils.isNotBlank(dPort)) {
+ setTargetPort(environment, dPort, true);
+ return;
+ }
+
+ //docker -e SEATA_PORT=8091
+ String envPort = environment.getProperty(ENV_SEATA_PORT_KEY, String.class);
+ if (StringUtils.isNotBlank(envPort)) {
+ setTargetPort(environment, envPort, true);
+ return;
+ }
+
+ //yml properties server.service-port=8091
+ String configPort = environment.getProperty(SERVER_SERVICE_PORT_CONFIG, String.class);
+ if (StringUtils.isNotBlank(configPort)) {
+ setTargetPort(environment, configPort, false);
+ return;
+ }
+
+ // server.port=7091
+ String serverPort = environment.getProperty("server.port", String.class);
+ if (StringUtils.isBlank(serverPort)) {
+ serverPort = "8080";
+ }
+ String servicePort = String.valueOf(Integer.parseInt(serverPort) + SERVICE_OFFSET_SPRING_BOOT);
+ setTargetPort(environment, servicePort, true);
+ }
+
+ private void setTargetPort(ConfigurableEnvironment environment, String port, boolean needAddPropertySource) {
+ // get rpc port first, use to logback-spring.xml, @see the class named `SystemPropertyLoggerContextListener`
+ System.setProperty(SERVER_SERVICE_PORT_CAMEL, port);
+
+ if (needAddPropertySource) {
+ // add property source to the first position
+ Properties pro = new Properties();
+ pro.setProperty(SERVER_SERVICE_PORT_CONFIG, port);
+ environment.getPropertySources().addFirst(new PropertiesPropertySource("serverProperties", pro));
+ }
+ }
+
+ /**
+ * higher than LoggingApplicationListener
+ *
+ * @return the order
+ */
+ @Override
+ public int getOrder() {
+ return LoggingApplicationListener.DEFAULT_ORDER - 1;
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerRunner.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerRunner.java
new file mode 100644
index 00000000..2d567df6
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerRunner.java
@@ -0,0 +1,82 @@
+/*
+ * 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.server;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import io.seata.core.rpc.Disposable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * @author spilledyear@outlook.com
+ */
+@Component
+public class ServerRunner implements CommandLineRunner, DisposableBean {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServerRunner.class);
+
+ private boolean started = Boolean.FALSE;
+
+ private static final List DISPOSABLE_LIST = new CopyOnWriteArrayList<>();
+
+ public static void addDisposable(Disposable disposable) {
+ DISPOSABLE_LIST.add(disposable);
+ }
+
+ @Override
+ public void run(String... args) {
+ try {
+ long start = System.currentTimeMillis();
+ Server.start(args);
+ started = true;
+
+ long cost = System.currentTimeMillis() - start;
+ LOGGER.info("seata server started in {} millSeconds", cost);
+ } catch (Throwable e) {
+ started = Boolean.FALSE;
+ LOGGER.error("seata server start error: {} ", e.getMessage(), e);
+ System.exit(-1);
+ }
+ }
+
+
+ public boolean started() {
+ return started;
+ }
+
+ @Override
+ public void destroy() throws Exception {
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("destoryAll starting");
+ }
+
+ for (Disposable disposable : DISPOSABLE_LIST) {
+ disposable.destroy();
+ }
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("destoryAll finish");
+ }
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/UUIDGenerator.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/UUIDGenerator.java
new file mode 100644
index 00000000..11aa492e
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/UUIDGenerator.java
@@ -0,0 +1,51 @@
+/*
+ * 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.server;
+
+import io.seata.common.util.IdWorker;
+
+/**
+ * The type Uuid generator.
+ *
+ * @author sharajava
+ */
+public class UUIDGenerator {
+
+ private static volatile IdWorker idWorker;
+
+ /**
+ * generate UUID using snowflake algorithm
+ * @return UUID
+ */
+ public static long generateUUID() {
+ if (idWorker == null) {
+ synchronized (UUIDGenerator.class) {
+ if (idWorker == null) {
+ init(null);
+ }
+ }
+ }
+ return idWorker.nextId();
+ }
+
+ /**
+ * init IdWorker
+ * @param serverNode the server node id, consider as machine id in snowflake
+ */
+ public static void init(Long serverNode) {
+ idWorker = new IdWorker(serverNode);
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/AbstractCheckAuthHandler.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/AbstractCheckAuthHandler.java
new file mode 100644
index 00000000..ecfbfc12
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/AbstractCheckAuthHandler.java
@@ -0,0 +1,53 @@
+/*
+ * 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.server.auth;
+
+import io.seata.config.ConfigurationFactory;
+import io.seata.core.constants.ConfigurationKeys;
+import io.seata.core.protocol.RegisterRMRequest;
+import io.seata.core.protocol.RegisterTMRequest;
+import io.seata.core.rpc.RegisterCheckAuthHandler;
+
+import static io.seata.common.DefaultValues.DEFAULT_SERVER_ENABLE_CHECK_AUTH;
+
+/**
+ * @author slievrly
+ */
+public abstract class AbstractCheckAuthHandler implements RegisterCheckAuthHandler {
+
+ private static final Boolean ENABLE_CHECK_AUTH = ConfigurationFactory.getInstance().getBoolean(
+ ConfigurationKeys.SERVER_ENABLE_CHECK_AUTH, DEFAULT_SERVER_ENABLE_CHECK_AUTH);
+
+ @Override
+ public boolean regTransactionManagerCheckAuth(RegisterTMRequest request) {
+ if (!ENABLE_CHECK_AUTH) {
+ return true;
+ }
+ return doRegTransactionManagerCheck(request);
+ }
+
+ public abstract boolean doRegTransactionManagerCheck(RegisterTMRequest request);
+
+ @Override
+ public boolean regResourceManagerCheckAuth(RegisterRMRequest request) {
+ if (!ENABLE_CHECK_AUTH) {
+ return true;
+ }
+ return doRegResourceManagerCheck(request);
+ }
+
+ public abstract boolean doRegResourceManagerCheck(RegisterRMRequest request);
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/DefaultCheckAuthHandler.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/DefaultCheckAuthHandler.java
new file mode 100644
index 00000000..ed3e9343
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/DefaultCheckAuthHandler.java
@@ -0,0 +1,37 @@
+/*
+ * 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.server.auth;
+
+import io.seata.common.loader.LoadLevel;
+import io.seata.core.protocol.RegisterRMRequest;
+import io.seata.core.protocol.RegisterTMRequest;
+
+/**
+ * @author slievrly
+ */
+@LoadLevel(name = "defaultCheckAuthHandler", order = 100)
+public class DefaultCheckAuthHandler extends AbstractCheckAuthHandler {
+
+ @Override
+ public boolean doRegTransactionManagerCheck(RegisterTMRequest request) {
+ return true;
+ }
+
+ @Override
+ public boolean doRegResourceManagerCheck(RegisterRMRequest request) {
+ return true;
+ }
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/BranchSessionController.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/BranchSessionController.java
new file mode 100644
index 00000000..b6980f42
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/BranchSessionController.java
@@ -0,0 +1,35 @@
+/*
+ * 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.server.console.controller;
+
+import javax.annotation.Resource;
+import io.seata.server.console.service.BranchSessionService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Branch Session Controller
+ * @author: zhongxiang.wang
+ */
+@RestController
+@RequestMapping("console/branchSession")
+public class BranchSessionController {
+
+ @Resource(type = BranchSessionService.class)
+ private BranchSessionService branchSessionService;
+
+
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalLockController.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalLockController.java
new file mode 100644
index 00000000..0be8fa41
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalLockController.java
@@ -0,0 +1,51 @@
+/*
+ * 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.server.console.controller;
+
+import javax.annotation.Resource;
+
+import io.seata.server.console.param.GlobalLockParam;
+import io.seata.console.result.PageResult;
+import io.seata.server.console.vo.GlobalLockVO;
+import io.seata.server.console.service.GlobalLockService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * Global Lock Controller
+ * @author: zhongxiang.wang
+ */
+@RestController
+@RequestMapping("/api/v1/console/globalLock")
+public class GlobalLockController {
+
+ @Resource(type = GlobalLockService.class)
+ private GlobalLockService globalLockService;
+
+ /**
+ * Query locks by param
+ * @param param the param
+ * @return the list of GlobalLockVO
+ */
+ @GetMapping("query")
+ public PageResult query(@ModelAttribute GlobalLockParam param) {
+ return globalLockService.query(param);
+ }
+
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java
new file mode 100644
index 00000000..cc5ceb11
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java
@@ -0,0 +1,50 @@
+/*
+ * 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.server.console.controller;
+
+import javax.annotation.Resource;
+
+import io.seata.server.console.param.GlobalSessionParam;
+import io.seata.console.result.PageResult;
+import io.seata.server.console.vo.GlobalSessionVO;
+import io.seata.server.console.service.GlobalSessionService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Global Session Controller
+ * @author: zhongxiang.wang
+ */
+@RestController
+@RequestMapping("/api/v1/console/globalSession")
+public class GlobalSessionController {
+
+ @Resource(type = GlobalSessionService.class)
+ private GlobalSessionService globalSessionService;
+
+ /**
+ * Query all globalSession
+ * @param param param for query globalSession
+ * @return the list of GlobalSessionVO
+ */
+ @GetMapping("query")
+ public PageResult query(@ModelAttribute GlobalSessionParam param) {
+ return globalSessionService.query(param);
+ }
+
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/BranchSessionDBServiceImpl.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/BranchSessionDBServiceImpl.java
new file mode 100644
index 00000000..367e71c5
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/BranchSessionDBServiceImpl.java
@@ -0,0 +1,102 @@
+/*
+ * 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.server.console.impl.db;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.DataSource;
+
+import io.seata.common.ConfigurationKeys;
+import io.seata.common.exception.StoreException;
+import io.seata.common.loader.EnhancedServiceLoader;
+import io.seata.common.util.IOUtil;
+import io.seata.common.util.StringUtils;
+import io.seata.config.Configuration;
+import io.seata.config.ConfigurationFactory;
+import io.seata.console.result.PageResult;
+import io.seata.core.store.db.DataSourceProvider;
+import io.seata.core.store.db.sql.log.LogStoreSqlsFactory;
+import io.seata.server.console.service.BranchSessionService;
+import io.seata.server.console.vo.BranchSessionVO;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
+import org.springframework.stereotype.Component;
+
+import static io.seata.common.DefaultValues.DEFAULT_STORE_DB_BRANCH_TABLE;
+
+/**
+ * Branch Session DataBase ServiceImpl
+ *
+ * @author: zhongxiang.wang
+ * @author: lvekee 734843455@qq.com
+ */
+@Component
+@org.springframework.context.annotation.Configuration
+@ConditionalOnExpression("#{'db'.equals('${sessionMode}')}")
+public class BranchSessionDBServiceImpl implements BranchSessionService {
+
+ private String branchTable;
+
+ private String dbType;
+
+ private DataSource dataSource;
+
+ public BranchSessionDBServiceImpl() {
+ Configuration configuration = ConfigurationFactory.getInstance();
+ branchTable = configuration.getConfig(ConfigurationKeys.STORE_DB_BRANCH_TABLE, DEFAULT_STORE_DB_BRANCH_TABLE);
+ dbType = configuration.getConfig(ConfigurationKeys.STORE_DB_TYPE);
+ if (StringUtils.isBlank(dbType)) {
+ throw new IllegalArgumentException(ConfigurationKeys.STORE_DB_TYPE + " should not be blank");
+ }
+ String dbDataSource = configuration.getConfig(ConfigurationKeys.STORE_DB_DATASOURCE_TYPE);
+ if (StringUtils.isBlank(dbDataSource)) {
+ throw new IllegalArgumentException(ConfigurationKeys.STORE_DB_DATASOURCE_TYPE + " should not be blank");
+ }
+ dataSource = EnhancedServiceLoader.load(DataSourceProvider.class, dbDataSource).provide();
+ }
+
+ @Override
+ public PageResult queryByXid(String xid) {
+ if (StringUtils.isBlank(xid)) {
+ throw new IllegalArgumentException("xid should not be blank");
+ }
+
+ String whereCondition = " where xid = ? ";
+ String branchSessionSQL = LogStoreSqlsFactory.getLogStoreSqls(dbType).getAllBranchSessionSQL(branchTable, whereCondition);
+
+ List list = new ArrayList<>();
+ ResultSet rs = null;
+
+ try (Connection conn = dataSource.getConnection();
+ PreparedStatement ps = conn.prepareStatement(branchSessionSQL)) {
+ ps.setObject(1, xid);
+ rs = ps.executeQuery();
+ while (rs.next()) {
+ list.add(BranchSessionVO.convert(rs));
+ }
+ } catch (SQLException e) {
+ throw new StoreException(e);
+ } finally {
+ IOUtil.close(rs);
+ }
+ return PageResult.success(list, list.size(), 0, 0, 0);
+ }
+
+}
diff --git a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/GlobalLockDBServiceImpl.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/GlobalLockDBServiceImpl.java
new file mode 100644
index 00000000..4a8a5a23
--- /dev/null
+++ b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/GlobalLockDBServiceImpl.java
@@ -0,0 +1,146 @@
+/*
+ * 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.server.console.impl.db;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.DataSource;
+
+import io.seata.common.ConfigurationKeys;
+import io.seata.common.exception.StoreException;
+import io.seata.common.loader.EnhancedServiceLoader;
+import io.seata.common.util.IOUtil;
+import io.seata.common.util.PageUtil;
+import io.seata.common.util.StringUtils;
+import io.seata.config.Configuration;
+import io.seata.config.ConfigurationFactory;
+import io.seata.console.result.PageResult;
+import io.seata.core.store.db.DataSourceProvider;
+import io.seata.core.store.db.sql.lock.LockStoreSqlFactory;
+import io.seata.server.console.param.GlobalLockParam;
+import io.seata.server.console.service.GlobalLockService;
+import io.seata.server.console.vo.GlobalLockVO;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
+import org.springframework.stereotype.Component;
+
+import static io.seata.common.DefaultValues.DEFAULT_LOCK_DB_TABLE;
+
+
+/**
+ * Global Lock DB ServiceImpl
+ *
+ * @author: zhongxiang.wang
+ * @author: lvekee 734843455@qq.com
+ */
+@Component
+@org.springframework.context.annotation.Configuration
+@ConditionalOnExpression("#{'db'.equals('${lockMode}')}")
+public class GlobalLockDBServiceImpl implements GlobalLockService {
+
+ private String lockTable;
+
+ private String dbType;
+
+ private DataSource dataSource;
+
+ public GlobalLockDBServiceImpl() {
+ Configuration configuration = ConfigurationFactory.getInstance();
+ lockTable = configuration.getConfig(ConfigurationKeys.LOCK_DB_TABLE, DEFAULT_LOCK_DB_TABLE);
+ dbType = configuration.getConfig(ConfigurationKeys.STORE_DB_TYPE);
+ if (StringUtils.isBlank(dbType)) {
+ throw new IllegalArgumentException(ConfigurationKeys.STORE_DB_TYPE + " should not be blank");
+ }
+ String dbDataSource = configuration.getConfig(ConfigurationKeys.STORE_DB_DATASOURCE_TYPE);
+ if (StringUtils.isBlank(dbDataSource)) {
+ throw new IllegalArgumentException(ConfigurationKeys.STORE_DB_DATASOURCE_TYPE + " should not be blank");
+ }
+ dataSource = EnhancedServiceLoader.load(DataSourceProvider.class, dbDataSource).provide();
+ }
+
+ @Override
+ public PageResult query(GlobalLockParam param) {
+ PageUtil.checkParam(param.getPageNum(), param.getPageSize());
+
+ List