diff --git a/ruoyi-visual/ruoyi-seata-server/pom.xml b/ruoyi-visual/ruoyi-seata-server/pom.xml
index d08c034ff..3660f26e1 100644
--- a/ruoyi-visual/ruoyi-seata-server/pom.xml
+++ b/ruoyi-visual/ruoyi-seata-server/pom.xml
@@ -28,10 +28,7 @@
1.7.1
- 1.82
- 1.2.12
2.7.18
- 0.9.20
7.2
3.8.0
@@ -46,20 +43,6 @@
pom
import
-
- io.seata
- seata-bom
- ${seata.version}
- pom
- import
-
-
- io.seata
- seata-dependencies
- ${seata.version}
- pom
- import
-
@@ -77,93 +60,15 @@
io.seata
- seata-spring-autoconfigure-server
+ seata-server
${seata.version}
-
-
-
- io.seata
- seata-core
-
-
- io.seata
- seata-config-all
- log4j
- log4j
+ slf4j-reload4j
+ org.slf4j
-
- 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
-
-
- com.mysql
- mysql-connector-j
-
-
- org.postgresql
- postgresql
-
-
-
-
- com.beust
- jcommander
- ${jcommander.version}
-
-
-
-
- com.google.guava
- guava
-
@@ -172,30 +77,12 @@
${jedis.version}
-
- com.alibaba
- fastjson
-
-
-
-
- ch.qos.logback
- logback-classic
-
-
- ch.qos.logback
- logback-core
-
net.logstash.logback
logstash-logback-encoder
${logstash-logback-encoder.version}
-
- org.codehaus.janino
- janino
-
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
deleted file mode 100644
index fdf0d28cc..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/AbstractTCInboundHandler.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * 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.*;
-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
deleted file mode 100644
index 55690fcaf..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ParameterParser.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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.server.env.ContainerHelper;
-import io.seata.server.store.StoreConfig;
-
-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);
- }
-
- /**
- * startup args > docker env
- * @param args
- */
- private void init(String[] args) {
- try {
- getCommandParameters(args);
- getEnvParameters();
- if (StringUtils.isNotBlank(seataEnv)) {
- System.setProperty(ENV_PROPERTY_KEY, seataEnv);
- }
- StoreConfig.setStartupParameter(storeMode, sessionStoreMode, lockStoreMode);
- } 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();
- }
- }
-
- 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 lockStoreMode;
- }
-
- /**
- * Gets session store mode.
- *
- * @return the store mode
- */
- public String getSessionStoreMode() {
- return sessionStoreMode;
- }
-
- /**
- * 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/Server.java b/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/Server.java
deleted file mode 100644
index 81eb1119e..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/Server.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.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.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 java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-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) {
- //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();
-
- ThreadPoolExecutor workingThreads = new ThreadPoolExecutor(NettyServerConfig.getMinServerPoolSize(),
- NettyServerConfig.getMaxServerPoolSize(), NettyServerConfig.getKeepAliveTime(), TimeUnit.SECONDS,
- new LinkedBlockingQueue<>(NettyServerConfig.getMaxTaskQueueSize()),
- new NamedThreadFactory("ServerHandlerThread", NettyServerConfig.getMaxServerPoolSize()), new ThreadPoolExecutor.CallerRunsPolicy());
-
- //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 nettyRemotingServer = new NettyRemotingServer(workingThreads);
- XID.setPort(nettyRemotingServer.getListenPort());
- UUIDGenerator.init(parameterParser.getServerNode());
- //log store mode : file, db, redis
- SessionHolder.init();
- LockerManagerFactory.init();
- 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);
-
- nettyRemotingServer.init();
- }
-}
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
deleted file mode 100644
index 303434052..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/ServerRunner.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.core.rpc.Disposable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.boot.web.context.WebServerInitializedEvent;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.core.Ordered;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-
-/**
- * @author spilledyear@outlook.com
- */
-@Component
-public class ServerRunner implements CommandLineRunner, DisposableBean,
- ApplicationListener, Ordered {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ServerRunner.class);
-
- private boolean started = Boolean.FALSE;
-
- private int port;
-
- @Value("${logging.file.path}")
- private String logPath;
-
- 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("\r\n you can visit seata console UI on http://127.0.0.1:{}. \r\n log path: {}.", this.port, this.logPath);
- 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");
- }
- }
-
- @Override
- public void onApplicationEvent(ApplicationEvent event) {
- if (event instanceof WebServerInitializedEvent) {
- this.port = ((WebServerInitializedEvent)event).getWebServer().getPort();
- }
- }
-
- @Override
- public int getOrder() {
- return Ordered.LOWEST_PRECEDENCE;
- }
-}
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
deleted file mode 100644
index 11aa492e9..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/UUIDGenerator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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
deleted file mode 100644
index ecfbfc12d..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/AbstractCheckAuthHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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
deleted file mode 100644
index ed3e9343c..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/auth/DefaultCheckAuthHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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
deleted file mode 100644
index f3ebf3f67..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/BranchSessionController.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 io.seata.server.console.service.BranchSessionService;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * 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
deleted file mode 100644
index e5fc3d011..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalLockController.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 io.seata.console.result.PageResult;
-import io.seata.server.console.param.GlobalLockParam;
-import io.seata.server.console.service.GlobalLockService;
-import io.seata.server.console.vo.GlobalLockVO;
-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;
-
-import javax.annotation.Resource;
-
-/**
- * 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
deleted file mode 100644
index 143354793..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/controller/GlobalSessionController.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 io.seata.console.result.PageResult;
-import io.seata.server.console.param.GlobalSessionParam;
-import io.seata.server.console.service.GlobalSessionService;
-import io.seata.server.console.vo.GlobalSessionVO;
-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;
-
-import javax.annotation.Resource;
-
-/**
- * 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
deleted file mode 100644
index 963b273cd..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/BranchSessionDBServiceImpl.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 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 javax.sql.DataSource;
-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 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
deleted file mode 100644
index 41d61efee..000000000
--- a/ruoyi-visual/ruoyi-seata-server/src/main/java/io/seata/server/console/impl/db/GlobalLockDBServiceImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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 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 javax.sql.DataSource;
-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 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