This is an automated email from the ASF dual-hosted git repository.
jianbin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git
The following commit(s) were added to refs/heads/2.x by this push:
new cbbfa222e3 optimize: add namingserver distribution (#6654)
cbbfa222e3 is described below
commit cbbfa222e32a49c80f34ec602b4e72d2c881e1d0
Author: ggbocoder <[email protected]>
AuthorDate: Fri Jul 12 11:49:52 2024 +0800
optimize: add namingserver distribution (#6654)
---
changes/en-us/2.x.md | 1 +
changes/zh-cn/2.x.md | 1 +
.../java/org/apache/seata/common/Constants.java | 24 --
.../org/apache/seata/common/metadata/Node.java | 3 +-
.../common/metadata/namingserver/InstanceTest.java | 1 -
.../test/resources/error/ErrorCode_en.properties | 1 +
.../io/seata/core/constants/DubboConstants.java | 1 -
.../core/rpc/netty/RmNettyRemotingClient.java | 1 -
console/pom.xml | 7 +-
distribution/bin/seata-namingserver-setup.sh | 166 ++++++++++++
distribution/bin/seata-namingserver.bat | 121 +++++++++
distribution/bin/seata-namingserver.sh | 297 +++++++++++++++++++++
distribution/pom.xml | 37 +++
...se-seata.xml => release-seata-namingserver.xml} | 81 ++----
distribution/release-seata.xml | 4 +-
namingserver/pom.xml | 87 ++++--
.../constants/NamingServerConstants.java | 47 ++--
.../namingserver/controller/NamingController.java | 3 +-
.../manager/ClusterWatcherManager.java | 5 +-
.../seata/namingserver/manager/NamingManager.java | 211 ++++++++-------
.../namingserver/pojo/AbstractClusterData.java | 3 +-
.../seata/namingserver/pojo/ClusterData.java | 18 +-
namingserver/src/main/resources/application.yml | 11 +-
.../src/main/resources/logback-spring.xml | 29 +-
.../main/resources/logback/console-appender.xml | 31 +++
.../src/main/resources/logback/file-appender.xml | 87 ++++++
.../seata/namingserver/NamingControllerTest.java | 49 +++-
.../src/{main => test}/resources/application.yml | 11 +-
pom.xml | 1 +
saga/seata-saga-spring/pom.xml | 1 -
.../engine/config/DbStateMachineConfigTest.java | 1 -
.../saga/engine/invoker/impl/MockService.java | 1 -
.../invoker/impl/SpringBeanServiceInvokerTest.java | 1 -
server/pom.xml | 4 +-
.../raft/serializer/CustomDeserializer.java | 20 +-
.../raft/serializer/JacksonBoltSerializer.java | 20 +-
test-mock-server/pom.xml | 4 +-
.../src/main/resources/application.yml | 3 +-
.../src/main/resources/logback-spring.xml | 1 -
...ansactionWithGlobalLockDataSourceBasicTest.java | 1 -
40 files changed, 1073 insertions(+), 323 deletions(-)
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 3df06203e3..631a19bef9 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -24,6 +24,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6534](https://github.com/apache/incubator-seata/pull/6534)] optimize:
send async response
- [[#6640](https://github.com/apache/incubator-seata/pull/6640)] modify
codecov config
- [[#6640](https://github.com/apache/incubator-seata/pull/6648)] add license
header
+- [[#6654](https://github.com/apache/incubator-seata/pull/6654)] add
Namingserver package module
### refactor:
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 6669e31149..92790fe5f5 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -24,6 +24,7 @@
- [[#6566](https://github.com/apache/incubator-seata/pull/6566)]
支持GlobalTransactionScanner类中exposeProxy属性的配置
- [[#6534](https://github.com/apache/incubator-seata/pull/6534)] 优化: 发送异步响应
- [[#6534](https://github.com/apache/incubator-seata/pull/6648)] 增加license
header信息
+- [[#6654](https://github.com/apache/incubator-seata/pull/6654)]
增加Namingserver打包功能
### refactor:
diff --git a/common/src/main/java/org/apache/seata/common/Constants.java
b/common/src/main/java/org/apache/seata/common/Constants.java
index 4e23c3dc4c..1c715b2dff 100644
--- a/common/src/main/java/org/apache/seata/common/Constants.java
+++ b/common/src/main/java/org/apache/seata/common/Constants.java
@@ -220,28 +220,4 @@ public interface Constants {
*/
String JACKSON_JSON_TEXT_PREFIX = "{\"@class\":";
- /**
- * The constant HTTP_PREFIX
- */
- String HTTP_PREFIX = "http://";
-
- /**
- * The constant HTTP_ADD_GROUP_SUFFIX
- */
- String HTTP_ADD_GROUP_SUFFIX = "/naming/v1/addVGroup?";
-
- /**
- * The constant CONSTANT_UNIT
- */
- String CONSTANT_UNIT = "unit";
-
- /**
- * The constant CONSTANT_GROUP
- */
- String CONSTANT_GROUP = "vGroup";
-
- /**
- * The constant HTTP_REMOVE_GROUP_SUFFIX
- */
- String HTTP_REMOVE_GROUP_SUFFIX = "/naming/v1/removeVGroup?";
}
diff --git a/common/src/main/java/org/apache/seata/common/metadata/Node.java
b/common/src/main/java/org/apache/seata/common/metadata/Node.java
index 71dba9b931..de77f00381 100644
--- a/common/src/main/java/org/apache/seata/common/metadata/Node.java
+++ b/common/src/main/java/org/apache/seata/common/metadata/Node.java
@@ -22,7 +22,6 @@ import java.util.Map;
public class Node {
- Map<String, Object> metadata = new HashMap<>();
private Endpoint control;
private Endpoint transaction;
@@ -34,6 +33,8 @@ public class Node {
private String version;
+ private Map<String, Object> metadata = new HashMap<>();
+
public Node() {}
public Endpoint createEndpoint(String host, int port, String protocol) {
diff --git
a/common/src/test/java/org/apache/seata/common/metadata/namingserver/InstanceTest.java
b/common/src/test/java/org/apache/seata/common/metadata/namingserver/InstanceTest.java
index 00b52d270a..77c5e669c1 100644
---
a/common/src/test/java/org/apache/seata/common/metadata/namingserver/InstanceTest.java
+++
b/common/src/test/java/org/apache/seata/common/metadata/namingserver/InstanceTest.java
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/common/src/test/resources/error/ErrorCode_en.properties
b/common/src/test/resources/error/ErrorCode_en.properties
index 65a0322edb..24a44239e4 100644
--- a/common/src/test/resources/error/ErrorCode_en.properties
+++ b/common/src/test/resources/error/ErrorCode_en.properties
@@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
ERR_PREFIX=ERR-CODE: [Seata-{code}][{key}]
ERR_POSTFIX=More: [https://seata.apache.org/docs/next/overview/faq#{code}]
ERR_CONFIG=config error, {0}
diff --git
a/compatible/src/main/java/io/seata/core/constants/DubboConstants.java
b/compatible/src/main/java/io/seata/core/constants/DubboConstants.java
index bb5c81acd6..fd6e488936 100644
--- a/compatible/src/main/java/io/seata/core/constants/DubboConstants.java
+++ b/compatible/src/main/java/io/seata/core/constants/DubboConstants.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package io.seata.core.constants;
/**
diff --git
a/compatible/src/main/java/io/seata/core/rpc/netty/RmNettyRemotingClient.java
b/compatible/src/main/java/io/seata/core/rpc/netty/RmNettyRemotingClient.java
index 6b23a6c2fa..04b14397b1 100644
---
a/compatible/src/main/java/io/seata/core/rpc/netty/RmNettyRemotingClient.java
+++
b/compatible/src/main/java/io/seata/core/rpc/netty/RmNettyRemotingClient.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package io.seata.core.rpc.netty;
/**
diff --git a/console/pom.xml b/console/pom.xml
index b97ff83c6e..0e1001ecbc 100644
--- a/console/pom.xml
+++ b/console/pom.xml
@@ -32,8 +32,8 @@
<description>console for Seata built with Maven</description>
<properties>
- <spring-boot-for-server.version>2.7.17</spring-boot-for-server.version>
-
<spring-framework-for-server.version>5.3.30</spring-framework-for-server.version>
+ <spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
+
<spring-framework-for-server.version>5.3.37</spring-framework-for-server.version>
<snakeyaml-for-server.version>2.0</snakeyaml-for-server.version>
<tomcat-embed.version>9.0.83</tomcat-embed.version>
</properties>
@@ -148,8 +148,7 @@
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-common</artifactId>
- <version>2.1.0-SNAPSHOT</version>
- <scope>compile</scope>
+ <version>${project.version}</version>
</dependency>
</dependencies>
<profiles>
diff --git a/distribution/bin/seata-namingserver-setup.sh
b/distribution/bin/seata-namingserver-setup.sh
new file mode 100644
index 0000000000..cfd4887b4d
--- /dev/null
+++ b/distribution/bin/seata-namingserver-setup.sh
@@ -0,0 +1,166 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+# Setup JVM parameters for seata server
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+BASEDIR=`cd "$PRGDIR/.." >/dev/null; pwd`
+BASEDIR=${BASEDIR//"//"/"/"}
+
+# Reset the REPO variable. If you need to influence this use the environment
setup file.
+REPO=
+
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ Darwin*) darwin=true
+ if [ -z "$JAVA_VERSION" ] ; then
+ JAVA_VERSION="CurrentJDK"
+ else
+ echo "Using Java version: $JAVA_VERSION"
+ fi
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ JAVA_HOME=`/usr/libexec/java_home`
+ else
+
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# If a specific java binary isn't specified search for the standard 'java'
binary
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD=`which java`
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." 1>&2
+ echo " We cannot execute $JAVACMD" 1>&2
+ exit 1
+fi
+
+if [ -z "$REPO" ]
+then
+ REPO="$BASEDIR"/lib
+fi
+
+CLASSPATH="$BASEDIR"/conf:"$REPO"/*
+
+ENDORSED_DIR=
+if [ -n "$ENDORSED_DIR" ] ; then
+ CLASSPATH=$BASEDIR/$ENDORSED_DIR/*:$CLASSPATH
+fi
+
+if [ -n "$CLASSPATH_PREFIX" ] ; then
+ CLASSPATH=$CLASSPATH_PREFIX:$CLASSPATH
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$HOME" ] && HOME=`cygpath --path --windows "$HOME"`
+ [ -n "$BASEDIR" ] && BASEDIR=`cygpath --path --windows "$BASEDIR"`
+ [ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"`
+fi
+
+JVM_XMX=$JVM_XMX
+JVM_XMS=$JVM_XMS
+JVM_XSS=$JVM_XSS
+JVM_MetaspaceSize=$JVM_MetaspaceSize
+JVM_MaxMetaspaceSize=$JVM_MaxMetaspaceSize
+JVM_MaxDirectMemorySize=$JVM_MaxDirectMemorySize
+LOADER_PATH=$LOADER_PATH
+LOG_HOME=$LOG_HOME
+if [ -z "$LOG_HOME" ]; then
+ LOG_HOME="$HOME/logs/seata"
+ mkdir -p $LOG_HOME
+fi
+JAVA_OPT="${JAVA_OPT} -Dlog.home=${LOG_HOME} -server
-Dloader.path=${LOADER_PATH:="$BASEDIR/lib"} -Xmx${JVM_XMX:="2048m"}
-Xms${JVM_XMS:="2048m"} -Xss${JVM_XSS:="640k"} -XX:SurvivorRatio=10
-XX:MetaspaceSize=${JVM_MetaspaceSize:="128m"}
-XX:MaxMetaspaceSize=${JVM_MaxMetaspaceSize:="256m"}
-XX:MaxDirectMemorySize=${JVM_MaxDirectMemorySize:=1024m}
-XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy"
+JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=${LOG_HOME}/java_heapdump.hprof -XX:+DisableExplicitGC"
+
+JAVA_MAJOR_VERSION=$($JAVACMD -version 2>&1 | sed '1!d' | sed -e 's/"//g' |
awk '{print $3}' | awk -F '.' '{print $1}')
+if [[ "$JAVA_MAJOR_VERSION" -eq "1" ]] ; then
+ JAVA_MAJOR_VERSION=$($JAVACMD -version 2>&1 | sed '1!d' | sed -e 's/"//g' |
awk '{print $3}' | awk -F '.' '{print $2}')
+fi
+if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
+ JAVA_OPT="${JAVA_OPT}
-Xlog:gc*:file=${LOG_HOME}/seata_gc.log:time,tags:filecount=10,filesize=10M"
+else
+ JAVA_OPT="${JAVA_OPT} -Xloggc:${LOG_HOME}/seata_gc.log -verbose:gc
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M
-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC"
+fi
+
+JAVA_OPT="${JAVA_OPT} -Dio.netty.leakDetectionLevel=advanced"
+JAVA_OPT="${JAVA_OPT} -Dapp.name=seata-namingserver -Dapp.pid=${$}
-Dapp.home=${BASEDIR} -Dbasedir=${BASEDIR}"
+
+if [ "$JMX_ENABLE" = "true" ]; then
+ JMX_PORT=$JMX_PORT
+ JMX_OPTS=$JMX_OPTS
+ if [ -z "$JMX_OPTS" ]; then
+ JMX_OPTS=" -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false "
+ fi
+ if [ -z "$JMX_PORT" ]; then
+ JMX_OPTS=" $JMX_OPTS
-Dcom.sun.management.jmxremote.port=${JMX_PORT:="10055"}
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT:="10055"} "
+ fi
+ echo "JMX enabled"
+else
+ echo "JMX disabled"
+fi
+
+JAVA_OPT="${JAVA_OPT} ${JMX_OPTS}"
+
+if [ ! -x "$BASEDIR"/logs ]; then
+ mkdir "$BASEDIR"/logs
+fi
diff --git a/distribution/bin/seata-namingserver.bat
b/distribution/bin/seata-namingserver.bat
new file mode 100644
index 0000000000..c0121c238a
--- /dev/null
+++ b/distribution/bin/seata-namingserver.bat
@@ -0,0 +1,121 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one or more
+@REM contributor license agreements. See the NOTICE file distributed with
+@REM this work for additional information regarding copyright ownership.
+@REM The ASF licenses this file to You under the Apache License, Version 2.0
+@REM (the "License"); you may not use this file except in compliance with
+@REM the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+@echo off
+
+chcp 65001
+
+set ERROR_CODE=0
+
+:init
+@REM Decide how to startup depending on the version of windows
+
+@REM -- Win98ME
+if NOT "%OS%"=="Windows_NT" goto Win9xArg
+
+@REM set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" @setlocal
+
+@REM -- 4NT shell
+if "%eval[2+2]" == "4" goto 4NTArgs
+
+@REM -- Regular WinNT shell
+set CMD_LINE_ARGS=%*
+goto WinNTGetScriptDir
+
+@REM The 4NT Shell from jp software
+:4NTArgs
+set CMD_LINE_ARGS=%$
+goto WinNTGetScriptDir
+
+:Win9xArg
+@REM Slurp the command line arguments. This loop allows for an unlimited
number
+@REM of arguments (up to the command line limit, anyway).
+set CMD_LINE_ARGS=
+:Win9xApp
+if %1a==a goto Win9xGetScriptDir
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto Win9xApp
+
+:Win9xGetScriptDir
+set SAVEDIR=%CD%
+%0\
+cd %0\..\..
+set BASEDIR=%CD%
+cd %SAVEDIR%
+set SAVE_DIR=
+goto repoSetup
+
+:WinNTGetScriptDir
+set BASEDIR=%~dp0
+set BASEDIR=%BASEDIR:~0,-5%
+
+:repoSetup
+set REPO=
+
+
+if "%JAVACMD%"=="" set JAVACMD=java
+
+if "%REPO%"=="" set REPO=%BASEDIR%\lib
+
+set CLASSPATH="%BASEDIR%"\conf;"%REPO%"\*
+
+set ENDORSED_DIR=
+if NOT "%ENDORSED_DIR%" == "" set
CLASSPATH="%BASEDIR%"\%ENDORSED_DIR%\*;%CLASSPATH%
+
+if NOT "%CLASSPATH_PREFIX%" == "" set CLASSPATH=%CLASSPATH_PREFIX%;%CLASSPATH%
+
+@REM Reaching here means variables are defined and arguments have been captured
+:endInit
+
+if exist %BASEDIR%/logs (
+ echo "%BASEDIR%/logs"
+) else (
+ md "%BASEDIR%/logs"
+)
+
+
+%JAVACMD% %JAVA_OPTS% -server -Dloader.path="%BASEDIR%"/lib -Xmx2048m
-Xms2048m -Xss512k -XX:SurvivorRatio=10 -XX:MetaspaceSize=128m
-XX:MaxMetaspaceSize=256m -XX:MaxDirectMemorySize=1024m
-XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath="%BASEDIR%"/logs/java_heapdump.hprof -XX:+DisableExplicitGC
-Xloggc:"%BASEDIR%"/logs/seata_namingserver_gc.log -verbose:gc
-Dio.netty.leakDetectionLevel=advanced -classpath %CLASSPATH% -Dapp.name [...]
+if %ERRORLEVEL% NEQ 0 goto error
+goto end
+
+:error
+if "%OS%"=="Windows_NT" @endlocal
+set ERROR_CODE=%ERRORLEVEL%
+
+:end
+@REM set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" goto endNT
+
+@REM For old DOS remove the set variables from ENV - we assume they were not
set
+@REM before we started - at least we don't leave any baggage around
+set CMD_LINE_ARGS=
+goto postExec
+
+:endNT
+@REM If error code is set to 1 then the endlocal was done already in :error.
+if %ERROR_CODE% EQU 0 @endlocal
+
+
+:postExec
+
+if "%FORCE_EXIT_ON_ERROR%" == "on" (
+ if %ERROR_CODE% NEQ 0 exit %ERROR_CODE%
+)
+
+exit /B %ERROR_CODE%
\ No newline at end of file
diff --git a/distribution/bin/seata-namingserver.sh
b/distribution/bin/seata-namingserver.sh
new file mode 100644
index 0000000000..18bf12e5f2
--- /dev/null
+++ b/distribution/bin/seata-namingserver.sh
@@ -0,0 +1,297 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+BASEDIR=`cd "$PRGDIR/.." >/dev/null; pwd`
+BASEDIR=${BASEDIR//"//"/"/"}
+
+. ${BASEDIR}/bin/seata-namingserver-setup.sh
+JAVA_OPT="${JAVA_OPT} -Dspring.config.additional-location=${BASEDIR}/conf/
-Dspring.config.location=${BASEDIR}/conf/application.yml
-Dlogging.config=${BASEDIR}/conf/logback-spring.xml
-Dproduction.deploy.output=true"
+JAVA_OPT="${JAVA_OPT} -jar ${BASEDIR}/target/seata-namingserver.jar"
+
+CMD_LINE_ARGS=$@
+NEW_ARGS=$(echo "${CMD_LINE_ARGS}" | sed -e 's/^start//g' -e 's/^restart//g'
-e 's/^ //g')
+
+show_usage() {
+ echo " Usage: sh seata-namingserver.sh(for linux and mac) or cmd
seata-namingserver.bat(for"
+ echo " windows) [options]"
+ echo " Options:"
+ echo " --host, -h"
+ echo " The ip to register to registry center."
+ echo " --port, -p"
+ echo " The port to listen."
+ echo " Default: 0"
+ echo " --storeMode, -m"
+ echo " log store mode : file, db, redis"
+ echo " --serverNode, -n"
+ echo " server node id, such as 1, 2, 3.it will be generated according
to the"
+ echo " snowflake by default"
+ echo " --seataEnv, -e"
+ echo " The name used for multi-configuration isolation."
+ echo " --sessionStoreMode, -ssm"
+ echo " session log store mode : file, db, redis"
+ echo " --lockStoreMode, -lsm"
+ echo " lock log store mode : file, db, redis"
+ echo " --help"
+}
+
+# start
+
+function validate_host() {
+ local host=$1
+ local re_ip="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
+ if [[ ! $host =~ $re_ip ]]; then
+ echo "Invalid host: $host"
+ show_usage
+ exit 1
+ fi
+}
+
+function validate_port() {
+ local port="$1"
+ if ! [[ "$port" =~ ^[0-9]+$ ]]; then
+ echo "Error: Invalid port: $port"
+ show_usage
+ exit 1
+ fi
+ return 0
+}
+
+function validate_mode() {
+ local mode="$1"
+ if [[ "$mode" != 'file' && "$mode" != 'db' && "$mode" != 'redis' ]]; then
+ echo "Error: Invalid storeMode: $mode"
+ show_usage
+ exit 1
+ fi
+ return 0
+}
+
+function validate_serverNode() {
+ local serverNode="$1"
+ if ! [[ "$serverNode" =~ ^[0-9]+$ ]]; then
+ echo "Error: Invalid serverNode: $serverNode"
+ show_usage
+ exit 1
+ fi
+ return 0
+}
+
+while [[ $# -gt 0 ]]; do
+ key="$1"
+ case "$key" in
+ start|stop|restart)
+ ;;
+ -h|--host)
+ if [[ -n "$2" ]]; then
+ validate_host "$2"
+ shift
+ else
+ echo "Error: Host value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ -p|--port)
+ if [[ -n "$2" ]]; then
+ validate_port "$2"
+ shift
+ else
+ echo "Error: Port value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ -m|--storeMode)
+ if [[ -n "$2" ]]; then
+ validate_mode "$2"
+ shift
+ else
+ echo "Error: storeMode value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ -ssm|--sessionStoreMode)
+ if [[ -n "$2" ]]; then
+ validate_mode "$2"
+ shift
+ else
+ echo "Error: sessionStoreMode value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ -lsm|--lockStoreMode)
+ if [[ -n "$2" ]]; then
+ validate_mode "$2"
+ shift
+ else
+ echo "Error: lockStoreMode value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ -e|--seataEnv)
+ if [[ -n "$2" ]]; then
+ shift
+ else
+ echo "Error: seataEnv value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ -n|--serverNode)
+ if [[ -n "$2" ]]; then
+ validate_serverNode "$2"
+ shift
+ else
+ echo "Error: serverNode value is required"
+ show_usage
+ exit 1
+ fi
+ ;;
+ --help)
+ show_usage
+ exit 1
+ ;;
+ *)
+ echo "Error: Unknown argument: $key"
+ show_usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+function start_server() {
+ echo "$JAVACMD ${JAVA_OPT} ${NEW_ARGS} &"
+ nohup $JAVACMD ${JAVA_OPT} ${NEW_ARGS} &
+ echo "seata-namingserver is starting, you can check the ${LOG_HOME}/ *.log"
+}
+
+function stop_server() {
+
+ PID=`ps aux | grep -i 'seata-namingserver' | grep java | grep -v grep | awk
'{print $2}'`
+
+ if [ -z "$PID" ]; then
+ echo "No seata-namingserver running."
+ exit 1;
+ fi
+ echo "The seata-namingserver(${PID}) is running..."
+ kill ${PID}
+ sleep 4
+ echo "Send shutdown request to seata-namingserver(${PID}) OK"
+
+}
+
+function replace_old_arg() {
+ local old_arg="$1"
+ local new_arg="$2"
+ for i in "${!OLD_ARGS_ARRAY[@]}"
+ do
+ if [[ "${OLD_ARGS_ARRAY[$i]}" == "$old_arg" ]]; then
+ OLD_ARGS_ARRAY[$i]="$new_arg"
+ found=1
+ for j in $(seq $((i+1)) "${#OLD_ARGS_ARRAY[@]}")
+ do
+ if [[ "${OLD_ARGS_ARRAY[$j]}" == "$old_arg" ]]; then
+ unset OLD_ARGS_ARRAY[$j]
+ else
+ break
+ fi
+ done
+ if [[ "$i+1" -lt "${#OLD_ARGS_ARRAY[@]}" && "${OLD_ARGS_ARRAY[$i+1]}" !=
-* ]]; then
+ OLD_ARGS_ARRAY[$i+1]="${new_arg_value# }"
+ fi
+ break
+ fi
+ done
+}
+
+function restart_server() {
+
+ PID=`ps aux | grep -i 'seata-namingserver' | grep java | grep -v grep | awk
'{print $2}'`
+ #filtered
+ OLD_ARGS=`ps -p $PID -o args= | grep -v "^$0" | sed -E
's/.*seata-namingserver.jar(.*)/\1/g'`
+ #Unfiltered
+ #OLD_ARGS=`ps -p $PID -o args= | grep -v "^$0"`
+ #echo "previous parameters ${OLD_ARGS}"
+ IFS=' ' read -r -a OLD_ARGS_ARRAY <<< "${OLD_ARGS}"
+ IFS=' ' read -r -a NEW_ARGS_ARRAY <<< "${NEW_ARGS}"
+
+ for new_arg in "${NEW_ARGS_ARRAY[@]}"
+ do
+ found=0
+ if [[ "$new_arg" == "-p" || "$new_arg" == "--port" ]]; then
+ replace_old_arg "-p" "$new_arg"
+ elif [[ "$new_arg" == "-h" || "$new_arg" == "--host" ]]; then
+ replace_old_arg "-h" "$new_arg"
+ elif [[ "$new_arg" == "-m" || "$new_arg" == "--storeMode" ]]; then
+ replace_old_arg "-m" "$new_arg"
+ elif [[ "$new_arg" == "-n" || "$new_arg" == "--serverNode" ]]; then
+ replace_old_arg "-n" "$new_arg"
+ elif [[ "$new_arg" == "-e" || "$new_arg" == "--seataEnv" ]]; then
+ replace_old_arg "-e" "$new_arg"
+ elif [[ "$new_arg" == "-ssm" || "$new_arg" == "--sessionStoreMode" ]]; then
+ replace_old_arg "-ssm" "$new_arg"
+ elif [[ "$new_arg" == "-lsm" || "$new_arg" == "--lockStoreMode" ]]; then
+ replace_old_arg "-lsm" "$new_arg"
+ fi
+ if [[ "$found" == 0 ]]; then
+ OLD_ARGS_ARRAY+=("$new_arg")
+ fi
+ done
+
+ NEW_ARGS=$(printf "%s " "${OLD_ARGS_ARRAY[@]}")
+ stop_server
+ echo "The seata-namingserver restarting..."
+ start_server
+}
+
+if [ -z "${CMD_LINE_ARGS}" ]; then
+ start_server
+else
+ case "${CMD_LINE_ARGS}" in
+ start*)
+ start_server
+ ;;
+ stop*)
+ stop_server
+ ;;
+ restart*)
+ restart_server
+ ;;
+ *)
+ start_server
+ ;;
+ esac
+fi
diff --git a/distribution/pom.xml b/distribution/pom.xml
index b63c0af563..8c3f30e421 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -74,6 +74,43 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>release-seata-namingserver</id>
+ <properties>
+ <maven.git-commit-id.skip>false</maven.git-commit-id.skip>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.seata</groupId>
+ <artifactId>seata-namingserver</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>apache-seata-namingserver</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven-assembly-plugin.version}</version>
+ <configuration>
+ <descriptors>
+
<descriptor>release-seata-namingserver.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>install</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<build>
diff --git a/distribution/release-seata.xml
b/distribution/release-seata-namingserver.xml
similarity index 52%
copy from distribution/release-seata.xml
copy to distribution/release-seata-namingserver.xml
index 3d0fd9c0c0..c3bd81801f 100644
--- a/distribution/release-seata.xml
+++ b/distribution/release-seata-namingserver.xml
@@ -27,27 +27,22 @@
</formats>
<fileSets>
- <fileSet>
- <includes>
- <include>plugins/**</include>
- </includes>
- </fileSet>
<fileSet>
<includes>
- <include>bin/*</include>
+ <include>bin/seata-namingserver.bat</include>
+ <include>bin/seata-namingserver.sh</include>
+ <include>bin/seata-namingserver-setup.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
- <includes>
- <include>logs/**</include>
- </includes>
+ <directory>../namingserver/target/lib/</directory>
+ <outputDirectory>lib</outputDirectory>
</fileSet>
-
<fileSet>
- <directory>../server/src/main/resources/logback/</directory>
+ <directory>../namingserver/src/main/resources/logback/</directory>
<outputDirectory>conf/logback/</outputDirectory>
<includes>
<include>**/*.xml</include>
@@ -55,74 +50,28 @@
</fileSet>
<fileSet>
-
<directory>../ext/apm-seata-skywalking-plugin/target/ext/skywalking-agent/</directory>
- <outputDirectory>ext/apm-skywalking</outputDirectory>
- </fileSet>
-
- <fileSet>
- <directory>../server/target/lib/</directory>
- <outputDirectory>lib</outputDirectory>
- </fileSet>
-
- <fileSet>
- <directory>../script/</directory>
- <outputDirectory>script</outputDirectory>
<includes>
- <include>**/server/</include>
- <include>**/logstash/</include>
- <include>**/config-center/</include>
+ <include>logs/**</include>
</includes>
</fileSet>
- </fileSets>
- <files>
- <file>
- <source>Dockerfile</source>
- <destName>Dockerfile</destName>
- </file>
- <file>
- <source>LICENSE</source>
- <destName>LICENSE</destName>
- </file>
-
- <file>
- <source>../DISCLAIMER</source>
- <destName>DISCLAIMER</destName>
- </file>
- <file>
- <source>NOTICE</source>
- <destName>NOTICE</destName>
- </file>
+ </fileSets>
+ <files>
<file>
- <source>../server/target/seata-server-exec.jar</source>
+ <source>../namingserver/target/seata-namingserver-exec.jar</source>
<outputDirectory>target/</outputDirectory>
- <destName>seata-server.jar</destName>
+ <destName>seata-namingserver.jar</destName>
</file>
-
- <file>
- <source>../server/src/main/resources/application.yml</source>
- <outputDirectory>conf/</outputDirectory>
- </file>
- <file>
-
<source>../server/src/main/resources/application.example.yml</source>
- <outputDirectory>conf/</outputDirectory>
- </file>
- <file>
-
<source>../server/src/main/resources/application.raft.example.yml</source>
- <outputDirectory>conf/</outputDirectory>
- </file>
-
<file>
<source>../server/src/main/resources/logback-spring.xml</source>
<outputDirectory>conf/</outputDirectory>
</file>
-
<file>
- <source>NOTICE.md</source>
- <outputDirectory>lib/jdbc/</outputDirectory>
+ <source>../namingserver/src/main/resources/application.yml</source>
+ <outputDirectory>conf/</outputDirectory>
</file>
</files>
@@ -130,8 +79,8 @@
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
- <include>org.apache.seata:seata-server</include>
+ <include>org.apache.seata:namingserver</include>
</includes>
</moduleSet>
</moduleSets>
-</assembly>
+</assembly>
\ No newline at end of file
diff --git a/distribution/release-seata.xml b/distribution/release-seata.xml
index 3d0fd9c0c0..d823289484 100644
--- a/distribution/release-seata.xml
+++ b/distribution/release-seata.xml
@@ -35,7 +35,9 @@
<fileSet>
<includes>
- <include>bin/*</include>
+ <include>bin/seata-server.bat</include>
+ <include>bin/seata-server.sh</include>
+ <include>bin/seata-setup.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
diff --git a/namingserver/pom.xml b/namingserver/pom.xml
index 47acc8f935..61e5b0bd8a 100644
--- a/namingserver/pom.xml
+++ b/namingserver/pom.xml
@@ -26,15 +26,14 @@
<version>${revision}</version>
</parent>
- <groupId>org.apache.seata</groupId>
- <artifactId>namingserver</artifactId>
- <name>namingserver ${project.version}</name>
+ <artifactId>seata-namingserver</artifactId>
+ <name>seata-namingserver ${project.version}</name>
<description>namingserver</description>
<properties>
- <java.version>8</java.version>
- <spring-boot-for-server.version>2.7.17</spring-boot-for-server.version>
-
<spring-framework-for-server.version>5.3.30</spring-framework-for-server.version>
+ <java.version>1.8</java.version>
+ <spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
+
<spring-framework-for-server.version>5.3.37</spring-framework-for-server.version>
</properties>
<dependencyManagement>
@@ -66,6 +65,18 @@
</dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.codehaus.janino</groupId>
+ <artifactId>janino</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.janino</groupId>
+ <artifactId>commons-compiler</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
@@ -80,11 +91,18 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j-to-slf4j</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-common</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
@@ -102,18 +120,14 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
</dependencies>
<build>
<plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <includeSystemScope>true</includeSystemScope>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -130,10 +144,10 @@
<stripVersion>false</stripVersion>
<silent>true</silent>
<overWriteIfNewer>true</overWriteIfNewer>
- <!-- resolve slf4j-simple conflicts -->
+ <!--resolve slf4j-simple conflicts-->
<includeScope>runtime</includeScope>
-
<excludeGroupIds>org.apache.logging.log4j,log4j,mysql</excludeGroupIds>
- <skip>false</skip>
+
<excludeGroupIds>org.apache.logging.log4j,log4j</excludeGroupIds>
+ <skip>${dependencies.copy.skip}</skip>
</configuration>
</execution>
</executions>
@@ -141,4 +155,43 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>release-seata-namingserver</id>
+ <properties>
+ <dependencies.copy.skip>false</dependencies.copy.skip>
+ </properties>
+ <build>
+ <finalName>seata-namingserver</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot-for-server.version}</version>
+ <configuration>
+
<mainClass>org.apache.seata.namingserver.NamingserverApplication</mainClass>
+ <layout>ZIP</layout>
+ <attach>false</attach>
+ <classifier>exec</classifier>
+ <includes>
+ <include>
+ <groupId>null</groupId>
+ <artifactId>null</artifactId>
+ </include>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
</project>
diff --git
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
b/namingserver/src/main/java/org/apache/seata/namingserver/constants/NamingServerConstants.java
similarity index 54%
copy from
saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
copy to
namingserver/src/main/java/org/apache/seata/namingserver/constants/NamingServerConstants.java
index 030933b499..91c11a3623 100644
---
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
+++
b/namingserver/src/main/java/org/apache/seata/namingserver/constants/NamingServerConstants.java
@@ -14,27 +14,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.seata.namingserver.constants;
-package org.apache.seata.saga.engine.invoker.impl;
+public interface NamingServerConstants {
+ /**
+ * The constant HTTP_PREFIX
+ */
+ String HTTP_PREFIX = "http://";
-/**
- * MockService
- */
-public class MockService {
- private int times;
+ /**
+ * The constant HTTP_ADD_GROUP_SUFFIX
+ */
+ String HTTP_ADD_GROUP_SUFFIX = "/naming/v1/addVGroup?";
+
+ /**
+ * The constant CONSTANT_UNIT
+ */
+ String CONSTANT_UNIT = "unit";
+
+ /**
+ * The constant CONSTANT_GROUP
+ */
+ String CONSTANT_GROUP = "vGroup";
- public String mockInvoke(String param) {
- return param;
- }
+ /**
+ * The constant HTTP_REMOVE_GROUP_SUFFIX
+ */
+ String HTTP_REMOVE_GROUP_SUFFIX = "/naming/v1/removeVGroup?";
- public boolean mockInvoke(boolean param) {
- return param;
- }
- public String mockInvokeRetry(String param) {
- times++;
- if (times > 2) {
- return param;
- }
- throw new RuntimeException("mockInvokeRetry");
- }
+ /**
+ * The constant IP_PORT_SPLIT_CHAR
+ */
+ String IP_PORT_SPLIT_CHAR = ":";
}
diff --git
a/namingserver/src/main/java/org/apache/seata/namingserver/controller/NamingController.java
b/namingserver/src/main/java/org/apache/seata/namingserver/controller/NamingController.java
index 1ee25b86b0..c7aa4e624f 100644
---
a/namingserver/src/main/java/org/apache/seata/namingserver/controller/NamingController.java
+++
b/namingserver/src/main/java/org/apache/seata/namingserver/controller/NamingController.java
@@ -19,6 +19,7 @@ package org.apache.seata.namingserver.controller;
import org.apache.seata.common.metadata.namingserver.MetaResponse;
import org.apache.seata.common.metadata.Node;
+import org.apache.seata.common.metadata.namingserver.NamingServerNode;
import org.apache.seata.common.result.Result;
import org.apache.seata.namingserver.listener.Watcher;
import org.apache.seata.namingserver.manager.ClusterWatcherManager;
@@ -58,7 +59,7 @@ public class NamingController {
public Result<?> registerInstance(@RequestParam String namespace,
@RequestParam String clusterName,
@RequestParam String unit,
- @RequestBody Node registerBody) {
+ @RequestBody NamingServerNode
registerBody) {
Result result = new Result();
boolean isSuccess = namingManager.registerInstance(registerBody,
namespace, clusterName, unit);
if (isSuccess) {
diff --git
a/namingserver/src/main/java/org/apache/seata/namingserver/manager/ClusterWatcherManager.java
b/namingserver/src/main/java/org/apache/seata/namingserver/manager/ClusterWatcherManager.java
index 9e2b203b62..f3b04a473a 100644
---
a/namingserver/src/main/java/org/apache/seata/namingserver/manager/ClusterWatcherManager.java
+++
b/namingserver/src/main/java/org/apache/seata/namingserver/manager/ClusterWatcherManager.java
@@ -16,15 +16,14 @@
*/
package org.apache.seata.namingserver.manager;
-import org.apache.seata.common.thread.NamedThreadFactory;
import org.apache.seata.namingserver.listener.ClusterChangeEvent;
import org.apache.seata.namingserver.listener.ClusterChangeListener;
import org.apache.seata.namingserver.listener.Watcher;
-import org.apache.seata.common.thread.NamedThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@@ -53,7 +52,7 @@ public class ClusterWatcherManager implements
ClusterChangeListener {
private static final Map<String/* vgroup */, Long> GROUP_UPDATE_TIME = new
ConcurrentHashMap<>();
private final ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
- new ScheduledThreadPoolExecutor(1, new
NamedThreadFactory("long-polling", 1));
+ new ScheduledThreadPoolExecutor(1, new
CustomizableThreadFactory("long-polling"));
@PostConstruct
public void init() {
diff --git
a/namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java
b/namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java
index 90ef381acd..be48c887fc 100644
---
a/namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java
+++
b/namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java
@@ -16,18 +16,17 @@
*/
package org.apache.seata.namingserver.manager;
-
-import jdk.internal.net.http.common.Pair;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.entity.ContentType;
import org.apache.http.protocol.HTTP;
-import org.apache.seata.common.Constants;
import org.apache.seata.common.metadata.Cluster;
import org.apache.seata.common.metadata.Node;
+import org.apache.seata.common.metadata.namingserver.NamingServerNode;
import org.apache.seata.common.metadata.namingserver.Unit;
import org.apache.seata.common.result.Result;
-import org.apache.seata.common.thread.NamedThreadFactory;
import org.apache.seata.common.util.HttpClientUtil;
+import org.apache.seata.namingserver.constants.NamingServerConstants;
import org.apache.seata.namingserver.listener.ClusterChangeEvent;
import org.apache.seata.namingserver.pojo.AbstractClusterData;
import org.apache.seata.namingserver.pojo.ClusterData;
@@ -37,6 +36,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
+import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
import org.springframework.stereotype.Component;
import java.io.IOException;
@@ -47,46 +47,57 @@ import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import javax.annotation.PostConstruct;
+
+
+import static
org.apache.seata.namingserver.constants.NamingServerConstants.CONSTANT_GROUP;
@Component
public class NamingManager {
private static final Logger LOGGER =
LoggerFactory.getLogger(NamingManager.class);
- private final HashMap<InetSocketAddress, Long> instanceLiveTable;
- private final HashMap<String/* VGroup */, HashMap<String/* namespace */,
Pair<String/* clusterName */, String/* unitName */>>> VGroupMap;
- private final HashMap<String/* namespace */, HashMap<String/* clusterName
*/, ClusterData>> NamespaceClusterDataMap;
- private int HEARTBEAT_TIME_THRESHOLD = 90 * 1000;
- private int HEARTBEAT_CHECK_TIME_PERIOD = 60 * 1000;
- protected final ScheduledExecutorService heartBeatCheckService = new
ScheduledThreadPoolExecutor(1,
- new NamedThreadFactory("heartBeatCheckExcuter", 1, true));
+ private final ConcurrentMap<InetSocketAddress, Long> instanceLiveTable;
+ private final ConcurrentMap<String/* VGroup */,
+ ConcurrentMap<String/* namespace */, Pair<String/* clusterName */,
String/* unitName */>>> vGroupMap;
+ private final ConcurrentMap<String/* namespace */, ConcurrentMap<String/*
clusterName */, ClusterData>> namespaceClusterDataMap;
+
+ @Value("${heartbeat.threshold:90000}")
+ private int heartbeatTimeThreshold;
+
+ @Value("${heartbeat.period:60000}")
+ private int heartbeatCheckTimePeriod;
+ protected final ScheduledExecutorService heartBeatCheckService =
+ new ScheduledThreadPoolExecutor(1, new
CustomizableThreadFactory("heartBeatCheckExcuter"));
@Autowired
private ApplicationContext applicationContext;
+ public NamingManager() {
+ this.instanceLiveTable = new ConcurrentHashMap<>();
+ this.vGroupMap = new ConcurrentHashMap<>();
+ this.namespaceClusterDataMap = new ConcurrentHashMap<>();
+ }
- public NamingManager(@Value("${heartbeat.threshold}") int
heartbeatThreshold,
- @Value("${heartbeat.period}") int heartbeatPeriod) {
- HEARTBEAT_CHECK_TIME_PERIOD = heartbeatPeriod;
- HEARTBEAT_TIME_THRESHOLD = heartbeatThreshold;
- this.instanceLiveTable = new HashMap<>();
- this.VGroupMap = new HashMap<>();
- this.NamespaceClusterDataMap = new HashMap<>();
- // start heartbeat checking
+ @PostConstruct
+ public void init() {
this.heartBeatCheckService.scheduleAtFixedRate(() -> {
try {
instanceHeartBeatCheck();
} catch (Exception e) {
LOGGER.error("Heart Beat Check Exception", e);
}
- }, 0, HEARTBEAT_CHECK_TIME_PERIOD, TimeUnit.MILLISECONDS);
+ }, heartbeatCheckTimePeriod, heartbeatCheckTimePeriod,
TimeUnit.MILLISECONDS);
}
public List<ClusterVO> monitorCluster(String namespace) {
- HashMap<String, ClusterVO> clusterVOHashMap = new HashMap<>();
- HashMap<String, ClusterData> clusterDataMap =
NamespaceClusterDataMap.get(namespace);
+ Map<String, ClusterVO> clusterVOHashMap = new HashMap<>();
+ Map<String, ClusterData> clusterDataMap =
namespaceClusterDataMap.get(namespace);
if (clusterDataMap != null) {
for (Map.Entry<String, ClusterData> entry :
clusterDataMap.entrySet()) {
@@ -98,11 +109,11 @@ public class NamingManager {
LOGGER.warn("no cluster in namespace:" + namespace);
}
- for (Map.Entry<String, HashMap<String, Pair<String, String>>> entry :
VGroupMap.entrySet()) {
+ for (Map.Entry<String, ConcurrentMap<String, Pair<String, String>>>
entry : vGroupMap.entrySet()) {
String vGroup = entry.getKey();
- HashMap<String, Pair<String, String>> namespaceMap =
entry.getValue();
+ Map<String, Pair<String, String>> namespaceMap = entry.getValue();
Pair<String, String> pair = namespaceMap.get(namespace);
- String clusterName = pair.first;
+ String clusterName = pair.getKey();
ClusterVO clusterVO = clusterVOHashMap.get(clusterName);
if (clusterVO != null) {
clusterVO.addMapping(vGroup);
@@ -110,11 +121,10 @@ public class NamingManager {
}
return new ArrayList<>(clusterVOHashMap.values());
-
}
public Result<?> addGroup(String namespace, String vGroup, String
clusterName, String unitName) {
-
+ changeGroup(namespace,clusterName,unitName,vGroup);
// add vGroup in new cluster
List<Node> nodeList = getInstances(namespace, clusterName);
if (nodeList == null || nodeList.size() == 0) {
@@ -124,20 +134,18 @@ public class NamingManager {
Node node = nodeList.get(0);
String controlHost = node.getControl().getHost();
int controlPort = node.getControl().getPort();
- String httpUrl = Constants.HTTP_PREFIX
- + controlHost
- + Constants.IP_PORT_SPLIT_CHAR
- + controlPort
- + Constants.HTTP_ADD_GROUP_SUFFIX;
+ String httpUrl = NamingServerConstants.HTTP_PREFIX + controlHost +
NamingServerConstants.IP_PORT_SPLIT_CHAR
+ + controlPort + NamingServerConstants.HTTP_ADD_GROUP_SUFFIX;
HashMap<String, String> params = new HashMap<>();
- params.put(Constants.CONSTANT_GROUP, vGroup);
- params.put(Constants.CONSTANT_UNIT, unitName);
+ params.put(CONSTANT_GROUP, vGroup);
+ params.put(NamingServerConstants.CONSTANT_UNIT, unitName);
Map<String, String> header = new HashMap<>();
header.put(HTTP.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED.getMimeType());
try (CloseableHttpResponse closeableHttpResponse =
HttpClientUtil.doGet(httpUrl, params, header, 30000)) {
if (closeableHttpResponse == null ||
closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
- return new
Result<>(String.valueOf(closeableHttpResponse.getStatusLine().getStatusCode()),
"add vGroup in new cluster failed");
+ return new
Result<>(String.valueOf(closeableHttpResponse.getStatusLine().getStatusCode()),
+ "add vGroup in new cluster failed");
}
} catch (IOException e) {
LOGGER.warn("add vGroup in new cluster failed");
@@ -152,28 +160,28 @@ public class NamingManager {
for (Cluster cluster : clusterList) {
if (cluster.getUnitData() != null && cluster.getUnitData().size()
> 0) {
Unit unit = cluster.getUnitData().get(0);
- if (unit != null
- && unit.getNamingInstanceList() != null
- && unit.getNamingInstanceList().size() > 0) {
+ if (unit != null && unit.getNamingInstanceList() != null &&
unit.getNamingInstanceList().size() > 0) {
Node node = unit.getNamingInstanceList().get(0);
- String httpUrl = Constants.HTTP_PREFIX
- + node.getControl().getHost()
- + Constants.IP_PORT_SPLIT_CHAR
- + node.getControl().getPort()
- + Constants.HTTP_REMOVE_GROUP_SUFFIX;
+ String httpUrl = NamingServerConstants.HTTP_PREFIX +
node.getControl().getHost()
+ + NamingServerConstants.IP_PORT_SPLIT_CHAR +
node.getControl().getPort()
+ + NamingServerConstants.HTTP_REMOVE_GROUP_SUFFIX;
HashMap<String, String> params = new HashMap<>();
- params.put(Constants.CONSTANT_GROUP, vGroup);
- params.put(Constants.CONSTANT_UNIT, unitName);
+ params.put(CONSTANT_GROUP, vGroup);
+ params.put(NamingServerConstants.CONSTANT_UNIT, unitName);
Map<String, String> header = new HashMap<>();
header.put(HTTP.CONTENT_TYPE,
ContentType.APPLICATION_FORM_URLENCODED.getMimeType());
- try (CloseableHttpResponse closeableHttpResponse =
HttpClientUtil.doGet(httpUrl, params, header, 30000)) {
- if (closeableHttpResponse == null ||
closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
+ try (CloseableHttpResponse closeableHttpResponse =
+ HttpClientUtil.doGet(httpUrl, params, header, 30000)) {
+ if (closeableHttpResponse == null
+ ||
closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
LOGGER.warn("remove vGroup in old cluster failed");
- return new
Result<>(String.valueOf(closeableHttpResponse.getStatusLine().getStatusCode()),
"removing vGroup " + vGroup + " in old cluster " + cluster + " failed");
+ return new
Result<>(String.valueOf(closeableHttpResponse.getStatusLine().getStatusCode()),
+ "removing vGroup " + vGroup + " in old cluster
" + cluster + " failed");
}
} catch (IOException e) {
LOGGER.warn("handle removing vGroup in old cluster
failed");
- return new Result<>("500", "handle removing vGroup " +
vGroup + " in old cluster " + cluster + " failed");
+ return new Result<>("500",
+ "handle removing vGroup " + vGroup + " in old
cluster " + cluster + " failed");
}
}
}
@@ -183,11 +191,11 @@ public class NamingManager {
public void changeGroup(String namespace, String clusterName, String
unitName, String vGroup) {
try {
- Pair<String, String> pair = new Pair<>(clusterName, unitName);
- HashMap<String, Pair<String, String>> stringPairHashMap = new
HashMap<>();
+ Pair<String, String> pair = Pair.of(clusterName, unitName);
+ ConcurrentMap<String, Pair<String, String>> stringPairHashMap =
new ConcurrentHashMap<>();
stringPairHashMap.put(namespace, pair);
- if (!VGroupMap.containsKey(vGroup) ||
!VGroupMap.get(vGroup).equals(stringPairHashMap)) {
- VGroupMap.put(vGroup, stringPairHashMap);
+ if (!vGroupMap.containsKey(vGroup) ||
!vGroupMap.get(vGroup).equals(stringPairHashMap)) {
+ vGroupMap.put(vGroup, stringPairHashMap);
applicationContext.publishEvent(new ClusterChangeEvent(this,
vGroup, System.currentTimeMillis()));
}
} catch (Exception e) {
@@ -196,19 +204,18 @@ public class NamingManager {
}
public void notifyClusterChange(String namespace, String clusterName,
String unitName) {
- for (Map.Entry<String, HashMap<String, Pair<String, String>>> entry :
VGroupMap.entrySet()) {
+ for (Map.Entry<String, ConcurrentMap<String, Pair<String, String>>>
entry : vGroupMap.entrySet()) {
String vGroup = entry.getKey();
- HashMap<String, Pair<String, String>> namespaceMap =
entry.getValue();
+ Map<String, Pair<String, String>> namespaceMap = entry.getValue();
// Iterating through an internal HashMap
for (Map.Entry<String, Pair<String, String>> innerEntry :
namespaceMap.entrySet()) {
String namespace1 = innerEntry.getKey();
Pair<String, String> pair = innerEntry.getValue();
- String clusterName1 = pair.first;
- String unitName1 = pair.second;
- if (namespace1.equals(namespace)
- && clusterName1.equals(clusterName)
- && (unitName1 == null || unitName1.equals(unitName))) {
+ String clusterName1 = pair.getKey();
+ String unitName1 = pair.getValue();
+ if (namespace1.equals(namespace) &&
clusterName1.equals(clusterName)
+ && (unitName1 == null || unitName1.equals(unitName))) {
applicationContext.publishEvent(new
ClusterChangeEvent(this, vGroup, System.currentTimeMillis()));
}
}
@@ -216,32 +223,33 @@ public class NamingManager {
}
- public boolean registerInstance(Node node, String namespace, String
clusterName, String unitName) {
+ public boolean registerInstance(NamingServerNode node, String namespace,
String clusterName, String unitName) {
try {
- HashMap<String, ClusterData> clusterDataHashMap =
NamespaceClusterDataMap.computeIfAbsent(namespace, k -> new HashMap<>());
+ Map<String, ClusterData> clusterDataHashMap =
+ namespaceClusterDataMap.computeIfAbsent(namespace, k -> new
ConcurrentHashMap<>());
// add instance in cluster
// create cluster when there is no cluster in clusterDataHashMap
- ClusterData clusterData =
clusterDataHashMap.computeIfAbsent(clusterName, key -> new
ClusterData(clusterName, (String) node.getMetadata().get("cluster-type")));
- node.getMetadata().remove("cluster-type");
+ ClusterData clusterData =
clusterDataHashMap.computeIfAbsent(clusterName,
+ key -> new ClusterData(clusterName,
(String)node.getMetadata().remove("cluster-type")));
// if extended metadata includes vgroup mapping relationship, add
it in clusterData
- Object mappingObj = node.getMetadata().get("vGroup");
-
- if (mappingObj instanceof HashMap) {
- HashMap<String, Object> mapping = (HashMap<String, Object>)
mappingObj;
- mapping.forEach((vGroup, unitObj) -> {
- changeGroup(namespace, clusterName, (String)
unitObj, vGroup);
- }
- );
- node.getMetadata().remove("vGroup");
- }
+
Optional.ofNullable(node.getMetadata().remove(CONSTANT_GROUP)).ifPresent(mappingObj
-> {
+ if (mappingObj instanceof List) {
+ List<String> vGroups = (List<String>)mappingObj;
+ for (String vGroup : vGroups) {
+ changeGroup(namespace, clusterName, unitName, vGroup);
+ }
+ }
+ });
boolean hasChanged = clusterData.registerInstance(node, unitName);
if (hasChanged) {
notifyClusterChange(namespace, clusterName, unitName);
}
- instanceLiveTable.put(new
InetSocketAddress(node.getTransaction().getHost(),
node.getTransaction().getPort()), System.currentTimeMillis());
+ instanceLiveTable.put(
+ new InetSocketAddress(node.getTransaction().getHost(),
node.getTransaction().getPort()),
+ System.currentTimeMillis());
} catch (Exception e) {
LOGGER.error("Instance registered failed!", e);
return false;
@@ -249,20 +257,19 @@ public class NamingManager {
return true;
}
-
public boolean unregisterInstance(String unitName, Node node) {
try {
- for (String namespace : NamespaceClusterDataMap.keySet()) {
- HashMap<String, ClusterData> clusterMap =
NamespaceClusterDataMap.get(namespace);
- if (clusterMap == null) continue;
- for (String clusterName : clusterMap.keySet()) {
- ClusterData clusterData = clusterMap.get(clusterName);
- if (clusterData == null) continue;
- if (clusterData.getUnitData() != null &&
clusterData.getUnitData().containsKey(unitName)) {
- clusterData.removeInstance(node, unitName);
- notifyClusterChange(namespace, clusterName, unitName);
- instanceLiveTable.remove(new
InetSocketAddress(node.getTransaction().getHost(),
node.getTransaction().getPort()));
- }
+ for (String namespace : namespaceClusterDataMap.keySet()) {
+ Map<String, ClusterData> clusterMap =
namespaceClusterDataMap.get(namespace);
+ if (clusterMap != null) {
+ clusterMap.forEach((clusterName, clusterData) -> {
+ if (clusterData.getUnitData() != null &&
clusterData.getUnitData().containsKey(unitName)) {
+ clusterData.removeInstance(node, unitName);
+ notifyClusterChange(namespace, clusterName,
unitName);
+ instanceLiveTable.remove(new
InetSocketAddress(node.getTransaction().getHost(),
+ node.getTransaction().getPort()));
+ }
+ });
}
}
} catch (Exception e) {
@@ -272,15 +279,14 @@ public class NamingManager {
return true;
}
-
public List<Cluster> getClusterListByVgroup(String vGroup, String
namespace) {
// find the cluster where the transaction group is located
List<Cluster> clusterList = new ArrayList<>();
try {
- Pair<String, String> clusterUnitPair =
VGroupMap.get(vGroup).get(namespace);
- String clusterName = clusterUnitPair.first;
- String unitName = clusterUnitPair.second;
- ClusterData clusterData =
NamespaceClusterDataMap.get(namespace).get(clusterName);
+ Pair<String, String> clusterUnitPair =
vGroupMap.get(vGroup).get(namespace);
+ String clusterName = clusterUnitPair.getKey();
+ String unitName = clusterUnitPair.getValue();
+ ClusterData clusterData =
namespaceClusterDataMap.get(namespace).get(clusterName);
clusterList.add(clusterData.getClusterByUnit(unitName));
} catch (NullPointerException e) {
LOGGER.error("no cluster mapping for vGroup: " + vGroup);
@@ -289,41 +295,42 @@ public class NamingManager {
}
public List<Node> getInstances(String namespace, String clusterName) {
- HashMap<String, ClusterData> clusterDataHashMap =
NamespaceClusterDataMap.get(namespace);
+ Map<String, ClusterData> clusterDataHashMap =
namespaceClusterDataMap.get(namespace);
AbstractClusterData abstractClusterData =
clusterDataHashMap.get(clusterName);
if (abstractClusterData == null) {
LOGGER.warn("no instances in {} : {}", namespace, clusterName);
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
return abstractClusterData.getInstanceList();
}
public void instanceHeartBeatCheck() {
- for (String namespace : NamespaceClusterDataMap.keySet()) {
- for (ClusterData clusterData :
NamespaceClusterDataMap.get(namespace).values()) {
+ for (String namespace : namespaceClusterDataMap.keySet()) {
+ for (ClusterData clusterData :
namespaceClusterDataMap.get(namespace).values()) {
for (Unit unit : clusterData.getUnitData().values()) {
Iterator<Node> instanceIterator =
unit.getNamingInstanceList().iterator();
while (instanceIterator.hasNext()) {
Node instance = instanceIterator.next();
- InetSocketAddress inetSocketAddress = new
InetSocketAddress(instance.getTransaction().getHost(),
instance.getTransaction().getPort());
- long lastHeatBeatTimeStamp =
instanceLiveTable.getOrDefault(inetSocketAddress, (long) 0);
+ InetSocketAddress inetSocketAddress = new
InetSocketAddress(instance.getTransaction().getHost(),
+ instance.getTransaction().getPort());
+ long lastHeatBeatTimeStamp =
instanceLiveTable.getOrDefault(inetSocketAddress, (long)0);
- if (Math.abs(lastHeatBeatTimeStamp -
System.currentTimeMillis()) > HEARTBEAT_TIME_THRESHOLD) {
+ if (Math.abs(lastHeatBeatTimeStamp -
System.currentTimeMillis()) > heartbeatTimeThreshold) {
instanceLiveTable.remove(inetSocketAddress);
- instanceIterator.remove(); // Safe removal using
iterator's remove method
+ instanceIterator.remove(); // Safe removal using
iterator's remove method
clusterData.removeInstance(instance,
unit.getUnitName());
notifyClusterChange(namespace,
clusterData.getClusterName(), unit.getUnitName());
- LOGGER.warn("{} instance has gone offline",
instance.getTransaction().getHost() + ":" +
instance.getTransaction().getPort());
+ LOGGER.warn("{} instance has gone offline",
+ instance.getTransaction().getHost() + ":" +
instance.getTransaction().getPort());
}
}
}
}
}
-
}
}
diff --git
a/namingserver/src/main/java/org/apache/seata/namingserver/pojo/AbstractClusterData.java
b/namingserver/src/main/java/org/apache/seata/namingserver/pojo/AbstractClusterData.java
index c9d7518d81..b17c58375d 100644
---
a/namingserver/src/main/java/org/apache/seata/namingserver/pojo/AbstractClusterData.java
+++
b/namingserver/src/main/java/org/apache/seata/namingserver/pojo/AbstractClusterData.java
@@ -18,6 +18,7 @@ package org.apache.seata.namingserver.pojo;
import org.apache.seata.common.metadata.Node;
+import org.apache.seata.common.metadata.namingserver.NamingServerNode;
import java.util.Collections;
import java.util.List;
@@ -30,7 +31,7 @@ public abstract class AbstractClusterData {
* @param unitName unit Name
* @return true if the node has changed, false if there is no change.
*/
- public boolean registerInstance(Node node, String unitName) {
+ public boolean registerInstance(NamingServerNode node, String unitName) {
return false;
}
diff --git
a/namingserver/src/main/java/org/apache/seata/namingserver/pojo/ClusterData.java
b/namingserver/src/main/java/org/apache/seata/namingserver/pojo/ClusterData.java
index 887760cd09..3b217d7bec 100644
---
a/namingserver/src/main/java/org/apache/seata/namingserver/pojo/ClusterData.java
+++
b/namingserver/src/main/java/org/apache/seata/namingserver/pojo/ClusterData.java
@@ -26,9 +26,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Component
@@ -36,20 +38,20 @@ public class ClusterData extends AbstractClusterData {
private static final Logger LOGGER =
LoggerFactory.getLogger(ClusterData.class);
private String clusterName;
private String clusterType;
- private final HashMap<String, Unit> unitData;
+ private final Map<String, Unit> unitData;
public ClusterData() {
- unitData = new HashMap<>(32);
+ unitData = new ConcurrentHashMap<>(32);
}
public ClusterData(String clusterName) {
- unitData = new HashMap<>(32);
+ unitData = new ConcurrentHashMap<>(32);
this.clusterName = clusterName;
}
public ClusterData(String clusterName, String clusterType) {
- unitData = new HashMap<>(32);
+ unitData = new ConcurrentHashMap<>(32);
this.clusterName = clusterName;
this.clusterType = clusterType;
}
@@ -71,7 +73,7 @@ public class ClusterData extends AbstractClusterData {
}
- public HashMap<String, Unit> getUnitData() {
+ public Map<String, Unit> getUnitData() {
return unitData;
}
@@ -103,14 +105,14 @@ public class ClusterData extends AbstractClusterData {
clusterResponse.setUnitData(new ArrayList<>(unitData.values()));
} else {
List<Unit> unitList = new ArrayList<>();
- unitList.add(unitData.get(unitName));
+
Optional.ofNullable(unitData.get(unitName)).ifPresent(unitList::add);
clusterResponse.setUnitData(unitList);
}
return clusterResponse;
}
-
+ @Override
public boolean registerInstance(NamingServerNode instance, String
unitName) {
// refresh node weight
Object weightValue = instance.getMetadata().get("weight");
diff --git a/namingserver/src/main/resources/application.yml
b/namingserver/src/main/resources/application.yml
index e4b8ba6322..ca73a0f2ab 100644
--- a/namingserver/src/main/resources/application.yml
+++ b/namingserver/src/main/resources/application.yml
@@ -20,8 +20,11 @@ server:
spring:
application:
- name: naming server
-
+ name: seata-namingserver
+logging:
+ config: classpath:logback-spring.xml
+ file:
+ path: ${log.home:${user.home}/logs/seata}
heartbeat:
- threshold: 3000
- period: 2000
\ No newline at end of file
+ threshold: 90000
+ period: 60000
\ No newline at end of file
diff --git a/test-mock-server/src/main/resources/logback-spring.xml
b/namingserver/src/main/resources/logback-spring.xml
similarity index 74%
copy from test-mock-server/src/main/resources/logback-spring.xml
copy to namingserver/src/main/resources/logback-spring.xml
index f1c30e82e8..1f57e7ab01 100644
--- a/test-mock-server/src/main/resources/logback-spring.xml
+++ b/namingserver/src/main/resources/logback-spring.xml
@@ -17,22 +17,19 @@
limitations under the License.
-->
-
<configuration scan="true" scanPeriod="60 seconds" debug="false">
- <!-- Context listeners -->
- <contextListener
class="org.apache.seata.server.logging.listener.SystemPropertyLoggerContextListener"/>
<!-- The conversion rules are copied from `defaults.xml` in the
`spring-boot-xxx.jar` -->
<conversionRule conversionWord="clr"
converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<!-- The custom conversion rules -->
- <conversionRule conversionWord="wEx2"
converterClass="org.apache.seata.server.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
+ <conversionRule conversionWord="wEx2"
converterClass="ch.qos.logback.classic.pattern.ExtendedThrowableProxyConverter"/>
<!-- common properties -->
- <springProperty name="PORT" source="server.port" defaultValue="7091"/>
+ <springProperty name="PORT" source="server.port" defaultValue="8081"/>
<springProperty name="LOG_BASH_DIR"
source="spring.config.additional-location" defaultValue="" />
- <springProperty name="APPLICATION_NAME" source="spring.application.name"
defaultValue="seata-server"/>
+ <springProperty name="APPLICATION_NAME" source="spring.application.name"
defaultValue="seata-namingserver"/>
<if condition='property("LOG_BASH_DIR").equals("")' >
<then>
@@ -42,22 +39,10 @@
<!-- file-appender -->
<include resource="logback/file-appender.xml"/>
- <!-- logstash-appender: off by default -->
- <!--<include resource="logback/logstash-appender.xml"/>-->
- <!-- metric-appender: off by default -->
- <!--<include resource="logback/metric-appender.xml"/>-->
- <!-- kafka-appender: off by default -->
- <!--<include resource="logback/kafka-appender.xml"/>-->
</then>
<else>
<include file="${LOG_BASH_DIR}/logback/console-appender.xml"/>
<include file="${LOG_BASH_DIR}/logback/file-appender.xml"/>
- <!-- logstash-appender: off by default -->
- <!--<include
file="${LOG_BASH_DIR}/logback/logstash-appender.xml"/>-->
- <!-- metric-appender: off by default -->
- <!--<include
file="${LOG_BASH_DIR}/logback/metric-appender.xml"/>-->
- <!-- kafka-appender: off by default -->
- <!--<include file="${LOG_BASH_DIR}/logback/kafka-appender.xml"/>-->
</else>
</if>
@@ -99,14 +84,6 @@
<appender-ref ref="ASYNC_FILE_ALL"/>
<appender-ref ref="ASYNC_FILE_WARN"/>
<appender-ref ref="ASYNC_FILE_ERROR"/>
- <!-- logstash-appender: off by default -->
- <!--<appender-ref ref="LOGSTASH"/>-->
-
- <!-- kafka-appender: off by default -->
- <!--<appender-ref ref="KAFKA"/>-->
-
- <!-- metric-appender: off by default -->
- <!--<appender-ref ref="METRIC"/>-->
</root>
<logger
name="org.springframework.security.config.annotation.web.builders.WebSecurity"
level="ERROR"/>
<logger name="org.springframework.security.web.DefaultSecurityFilterChain"
level="ERROR"/>
diff --git a/namingserver/src/main/resources/logback/console-appender.xml
b/namingserver/src/main/resources/logback/console-appender.xml
new file mode 100644
index 0000000000..6aaec286d9
--- /dev/null
+++ b/namingserver/src/main/resources/logback/console-appender.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+
+-->
+<included>
+ <!-- console-appender properties -->
+ <springProperty name="CONSOLE_LOG_PATTERN" source="logging.pattern.console"
+ defaultValue="%clr(%d{HH:mm:ss.SSS}){faint} %clr(%5p)
%clr(---){faint} %clr([%25.25t]){faint} %clr([%-30.30logger]){cyan}
%clr([%20.20M]){faint} %clr([%X{X-TX-XID:-}]){faint} %clr(:){faint}
%m%n%wEx2"/>
+
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+</included>
diff --git a/namingserver/src/main/resources/logback/file-appender.xml
b/namingserver/src/main/resources/logback/file-appender.xml
new file mode 100644
index 0000000000..39d7f99ed1
--- /dev/null
+++ b/namingserver/src/main/resources/logback/file-appender.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+
+-->
+<included>
+ <!-- file-appender properties -->
+ <springProperty name="LOG_FILE_PATH" source="logging.file.path"
+ defaultValue="${user.home}/logs/seata"/>
+ <springProperty name="FILE_LOG_PATTERN" source="logging.pattern.file"
+ defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p --- [%t]
[%logger] [%M] [%X{X-TX-XID:-}]: %m%n%wEx2"/>
+
+ <!--ALL-->
+ <appender name="FILE_ALL"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+
<file>${LOG_FILE_PATH}/${APPLICATION_NAME:-seata-namingserver}.${RPC_PORT}.all.log</file>
+ <append>true</append>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${LOG_FILE_PATH}/history/${APPLICATION_NAME:-seata-namingserver}.${RPC_PORT}.all.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
+ <maxFileSize>2GB</maxFileSize>
+ <MaxHistory>7</MaxHistory>
+ <totalSizeCap>7GB</totalSizeCap>
+ <cleanHistoryOnStart>true</cleanHistoryOnStart>
+ </rollingPolicy>
+ <encoder>
+ <Pattern>${FILE_LOG_PATTERN}</Pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+
+ <!--WARN-->
+ <appender name="FILE_WARN"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>WARN</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+
<file>${LOG_FILE_PATH}/${APPLICATION_NAME:-seata-namingserver}.${RPC_PORT}.warn.log</file>
+ <append>true</append>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${LOG_FILE_PATH}/history/${APPLICATION_NAME:-seata-namingserver}.${RPC_PORT}.warn.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
+ <maxFileSize>2GB</maxFileSize>
+ <MaxHistory>7</MaxHistory>
+ <totalSizeCap>7GB</totalSizeCap>
+ <cleanHistoryOnStart>true</cleanHistoryOnStart>
+ </rollingPolicy>
+ <encoder>
+ <Pattern>${FILE_LOG_PATTERN}</Pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+
+ <!--ERROR-->
+ <appender name="FILE_ERROR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>ERROR</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+
<file>${LOG_FILE_PATH}/${APPLICATION_NAME:-seata-namingserver}.${RPC_PORT}.error.log</file>
+ <append>true</append>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>${LOG_FILE_PATH}/history/${APPLICATION_NAME:-seata-namingserver}.${RPC_PORT}.error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
+ <maxFileSize>2GB</maxFileSize>
+ <MaxHistory>7</MaxHistory>
+ <totalSizeCap>7GB</totalSizeCap>
+ <cleanHistoryOnStart>true</cleanHistoryOnStart>
+ </rollingPolicy>
+ <encoder>
+ <Pattern>${FILE_LOG_PATTERN}</Pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+</included>
diff --git
a/namingserver/src/test/java/org/apache/seata/namingserver/NamingControllerTest.java
b/namingserver/src/test/java/org/apache/seata/namingserver/NamingControllerTest.java
index 704a1f23a7..2974e06477 100644
---
a/namingserver/src/test/java/org/apache/seata/namingserver/NamingControllerTest.java
+++
b/namingserver/src/test/java/org/apache/seata/namingserver/NamingControllerTest.java
@@ -19,6 +19,7 @@ package org.apache.seata.namingserver;
import org.apache.seata.common.metadata.Cluster;
import org.apache.seata.common.metadata.Node;
import org.apache.seata.common.metadata.namingserver.MetaResponse;
+import org.apache.seata.common.metadata.namingserver.NamingServerNode;
import org.apache.seata.common.metadata.namingserver.Unit;
import org.apache.seata.namingserver.controller.NamingController;
import org.junit.jupiter.api.Test;
@@ -28,10 +29,16 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
+
+import static
org.apache.seata.namingserver.constants.NamingServerConstants.CONSTANT_GROUP;
import static org.junit.jupiter.api.Assertions.*;
+
@RunWith(SpringRunner.class)
@SpringBootTest
class NamingControllerTest {
@@ -50,11 +57,12 @@ class NamingControllerTest {
String clusterName = "cluster1";
String namespace = "public";
String unitName = String.valueOf(UUID.randomUUID());
- Node node = new Node();
- node.setTransaction(new Node.Endpoint("127.0.0.1", 8080, "netty"));
+ NamingServerNode node = new NamingServerNode();
+ node.setTransaction(new Node.Endpoint("127.0.0.1", 8091, "netty"));
+ node.setControl(new Node.Endpoint("127.0.0.1", 7091, "http"));
namingController.registerInstance(namespace, clusterName, unitName,
node);
String vGroup = "vgroup1";
- namingController.changeGroup(namespace, clusterName, null, vGroup);
+ namingController.changeGroup(namespace, clusterName, unitName, vGroup);
MetaResponse metaResponse = namingController.discovery(vGroup,
namespace);
assertNotNull(metaResponse);
assertNotNull(metaResponse.getClusterList());
@@ -67,7 +75,7 @@ class NamingControllerTest {
assertEquals(1, unit.getNamingInstanceList().size());
Node node1 = unit.getNamingInstanceList().get(0);
assertEquals("127.0.0.1", node1.getTransaction().getHost());
- assertEquals(8080, node1.getTransaction().getPort());
+ assertEquals(8091, node1.getTransaction().getPort());
namingController.unregisterInstance(unitName, node);
}
@@ -76,11 +84,23 @@ class NamingControllerTest {
String clusterName = "cluster1";
String namespace = "public";
String unitName = String.valueOf(UUID.randomUUID());
- Node node = new Node();
- node.setTransaction(new Node.Endpoint("127.0.0.1", 8080, "netty"));
+ NamingServerNode node = new NamingServerNode();
+ node.setTransaction(new Node.Endpoint("127.0.0.1", 8091, "netty"));
+ node.setControl(new Node.Endpoint("127.0.0.1", 7091, "http"));
+ Map<String, Object> meatadata = node.getMetadata();
+ List<String> vGroups = new ArrayList<>();
+ vGroups.add("vgroup1");
+ meatadata.put(CONSTANT_GROUP, vGroups);
namingController.registerInstance(namespace, clusterName, unitName,
node);
+ NamingServerNode node2 = new NamingServerNode();
+ node2.setTransaction(new Node.Endpoint("127.0.0.1", 8091, "netty"));
+ node2.setControl(new Node.Endpoint("127.0.0.1", 7091, "http"));
+ Map<String, Object> meatadata2 = node2.getMetadata();
+ List<String> vGroups2 = new ArrayList<>();
+ vGroups2.add("vgroup2");
+ meatadata2.put(CONSTANT_GROUP, vGroups2);
+ namingController.registerInstance(namespace, "cluster2",
UUID.randomUUID().toString(), node2);
String vGroup = "vgroup1";
- namingController.changeGroup(namespace, clusterName, null, vGroup);
MetaResponse metaResponse = namingController.discovery(vGroup,
namespace);
assertNotNull(metaResponse);
assertNotNull(metaResponse.getClusterList());
@@ -93,7 +113,7 @@ class NamingControllerTest {
assertEquals(1, unit.getNamingInstanceList().size());
Node node1 = unit.getNamingInstanceList().get(0);
assertEquals("127.0.0.1", node1.getTransaction().getHost());
- assertEquals(8080, node1.getTransaction().getPort());
+ assertEquals(8091, node1.getTransaction().getPort());
namingController.unregisterInstance(unitName, node);
metaResponse = namingController.discovery(vGroup, namespace);
assertNotNull(metaResponse);
@@ -108,11 +128,16 @@ class NamingControllerTest {
String clusterName = "cluster1";
String namespace = "public";
String unitName = String.valueOf(UUID.randomUUID());
- Node node = new Node();
- node.setTransaction(new Node.Endpoint("127.0.0.1", 8080, "netty"));
+ NamingServerNode node = new NamingServerNode();
+ node.setTransaction(new Node.Endpoint("127.0.0.1", 8091, "netty"));
+ node.setControl(new Node.Endpoint("127.0.0.1", 7091, "http"));
+ Map<String, Object> meatadata = node.getMetadata();
+ List<String> vGroups = new ArrayList<>();
+ vGroups.add("vgroup1");
+ meatadata.put(CONSTANT_GROUP, vGroups);
namingController.registerInstance(namespace, clusterName, unitName,
node);
String vGroup = "vgroup1";
- namingController.changeGroup(namespace, clusterName, null, vGroup);
+ //namingController.changeGroup(namespace, clusterName, vGroup, vGroup);
MetaResponse metaResponse = namingController.discovery(vGroup,
namespace);
assertNotNull(metaResponse);
assertNotNull(metaResponse.getClusterList());
@@ -125,7 +150,7 @@ class NamingControllerTest {
assertEquals(1, unit.getNamingInstanceList().size());
Node node1 = unit.getNamingInstanceList().get(0);
assertEquals("127.0.0.1", node1.getTransaction().getHost());
- assertEquals(8080, node1.getTransaction().getPort());
+ assertEquals(8091, node1.getTransaction().getPort());
int timeGap = threshold + period;
Thread.sleep(timeGap);
metaResponse = namingController.discovery(vGroup, namespace);
diff --git a/namingserver/src/main/resources/application.yml
b/namingserver/src/test/resources/application.yml
similarity index 83%
copy from namingserver/src/main/resources/application.yml
copy to namingserver/src/test/resources/application.yml
index e4b8ba6322..0aaca022b8 100644
--- a/namingserver/src/main/resources/application.yml
+++ b/namingserver/src/test/resources/application.yml
@@ -20,8 +20,11 @@ server:
spring:
application:
- name: naming server
-
+ name: seata-namingserver
+logging:
+ config: classpath:logback-spring.xml
+ file:
+ path: ${log.home:${user.home}/logs/seata}
heartbeat:
- threshold: 3000
- period: 2000
\ No newline at end of file
+ threshold: 5000
+ period: 5000
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 69d9142a58..c2e923af7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,7 @@
<module>server</module>
<module>ext/apm-seata-skywalking-plugin</module>
<module>integration-tx-api</module>
+ <module>namingserver</module>
<!--<module>seata-plugin</module>-->
</modules>
diff --git a/saga/seata-saga-spring/pom.xml b/saga/seata-saga-spring/pom.xml
index 78d1c13591..fc967e79f7 100644
--- a/saga/seata-saga-spring/pom.xml
+++ b/saga/seata-saga-spring/pom.xml
@@ -17,7 +17,6 @@
limitations under the License.
-->
-
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
diff --git
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/config/DbStateMachineConfigTest.java
b/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/config/DbStateMachineConfigTest.java
index 979676f6f6..ba2afff458 100644
---
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/config/DbStateMachineConfigTest.java
+++
b/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/config/DbStateMachineConfigTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.seata.saga.engine.config;
import java.sql.Connection;
diff --git
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
b/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
index 030933b499..f23980503d 100644
---
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
+++
b/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/MockService.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.seata.saga.engine.invoker.impl;
/**
diff --git
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/SpringBeanServiceInvokerTest.java
b/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/SpringBeanServiceInvokerTest.java
index 3d0b487909..444b317a15 100644
---
a/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/SpringBeanServiceInvokerTest.java
+++
b/saga/seata-saga-spring/src/test/java/org/apache/seata/saga/engine/invoker/impl/SpringBeanServiceInvokerTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.seata.saga.engine.invoker.impl;
import java.util.Collections;
diff --git a/server/pom.xml b/server/pom.xml
index 2e6cef69f0..ca1ad4a50e 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -32,8 +32,8 @@
<description>server for Seata built with Maven</description>
<properties>
- <spring-boot-for-server.version>2.7.17</spring-boot-for-server.version>
-
<spring-framework-for-server.version>5.3.30</spring-framework-for-server.version>
+ <spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
+
<spring-framework-for-server.version>5.3.37</spring-framework-for-server.version>
<snakeyaml-for-server.version>2.0</snakeyaml-for-server.version>
<tomcat-embed.version>9.0.83</tomcat-embed.version>
</properties>
diff --git
a/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/CustomDeserializer.java
b/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/CustomDeserializer.java
index 9987a203df..6e7a4a0eb9 100644
---
a/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/CustomDeserializer.java
+++
b/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/CustomDeserializer.java
@@ -1,14 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE
- * file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file
- * to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * 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.
+ * 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 org.apache.seata.server.cluster.raft.serializer;
diff --git
a/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/JacksonBoltSerializer.java
b/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/JacksonBoltSerializer.java
index 740f9ff81a..75a44268f0 100644
---
a/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/JacksonBoltSerializer.java
+++
b/server/src/main/java/org/apache/seata/server/cluster/raft/serializer/JacksonBoltSerializer.java
@@ -1,14 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE
- * file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file
- * to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * 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.
+ * 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 org.apache.seata.server.cluster.raft.serializer;
diff --git a/test-mock-server/pom.xml b/test-mock-server/pom.xml
index af6f9916da..0ff11e1148 100644
--- a/test-mock-server/pom.xml
+++ b/test-mock-server/pom.xml
@@ -55,8 +55,8 @@
</build>
<properties>
- <spring-boot-for-server.version>2.7.17</spring-boot-for-server.version>
-
<spring-framework-for-server.version>5.3.30</spring-framework-for-server.version>
+ <spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
+
<spring-framework-for-server.version>5.3.37</spring-framework-for-server.version>
<snakeyaml-for-server.version>2.0</snakeyaml-for-server.version>
</properties>
<dependencyManagement>
diff --git a/test-mock-server/src/main/resources/application.yml
b/test-mock-server/src/main/resources/application.yml
index 473af44977..978398eb83 100644
--- a/test-mock-server/src/main/resources/application.yml
+++ b/test-mock-server/src/main/resources/application.yml
@@ -14,9 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
server:
port: 7091
- servicePort: 8091
+ service-port: 8091
spring:
application:
diff --git a/test-mock-server/src/main/resources/logback-spring.xml
b/test-mock-server/src/main/resources/logback-spring.xml
index f1c30e82e8..9650c0b56e 100644
--- a/test-mock-server/src/main/resources/logback-spring.xml
+++ b/test-mock-server/src/main/resources/logback-spring.xml
@@ -17,7 +17,6 @@
limitations under the License.
-->
-
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- Context listeners -->
<contextListener
class="org.apache.seata.server.logging.listener.SystemPropertyLoggerContextListener"/>
diff --git
a/test/src/test/java/LocalTransactionWithGlobalLockDataSourceBasicTest.java
b/test/src/test/java/LocalTransactionWithGlobalLockDataSourceBasicTest.java
index b218ff041e..0556761da1 100644
--- a/test/src/test/java/LocalTransactionWithGlobalLockDataSourceBasicTest.java
+++ b/test/src/test/java/LocalTransactionWithGlobalLockDataSourceBasicTest.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.util.Date;
import org.apache.seata.core.context.RootContext;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]