From e0548509d1b378b038d17229bf328237c6ad883e Mon Sep 17 00:00:00 2001 From: liuyuanmu Date: Tue, 15 Feb 2022 17:03:27 +0800 Subject: [PATCH] support jdk gt 8 --- core | 2 +- .../src/main/resources/scripts/startup.sh | 13 +++++++++++- deploy/deploy-peer/pom.xml | 5 ----- .../src/main/resources/assembly.xml | 17 --------------- .../src/main/resources/scripts/ledger-init.sh | 12 ++++++++++- .../resources/scripts/manager-shutdown.sh | 21 ------------------- .../main/resources/scripts/manager-startup.sh | 19 ----------------- .../main/resources/scripts/peer-startup.sh | 13 +++++++++++- explorer | 2 +- libs/bft-smart | 2 +- project | 2 +- 11 files changed, 39 insertions(+), 69 deletions(-) delete mode 100644 deploy/deploy-peer/src/main/resources/scripts/manager-shutdown.sh delete mode 100644 deploy/deploy-peer/src/main/resources/scripts/manager-startup.sh diff --git a/core b/core index 89f3f28f..b43f3c9e 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 89f3f28f8ac2d3f5bc3a85f3bf5d142e7fb281f8 +Subproject commit b43f3c9eed822b96e6fe580903fd0d0b65056557 diff --git a/deploy/deploy-gateway/src/main/resources/scripts/startup.sh b/deploy/deploy-gateway/src/main/resources/scripts/startup.sh index a540923c..cc94fc47 100644 --- a/deploy/deploy-gateway/src/main/resources/scripts/startup.sh +++ b/deploy/deploy-gateway/src/main/resources/scripts/startup.sh @@ -34,8 +34,19 @@ GATEWAY_CONFIG=$CONFIG_PATH/gateway.conf #application-gw.properties完整路径 SPRING_CONFIG=$CONFIG_PATH/application-gw.properties +JDK_VERSION=$(java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}') +if [[ $JDK_VERSION == 1.8.* ]]; then + opens="" +else + opens="--add-opens java.base/java.lang=ALL-UNNAMED" + opens=$opens" --add-opens java.base/java.util=ALL-UNNAMED" + opens=$opens" --add-opens java.base/java.net=ALL-UNNAMED" + opens=$opens" --add-opens java.base/sun.security.x509=ALL-UNNAMED" + opens=$opens" --add-opens java.base/sun.security.util=ALL-UNNAMED" +fi + #定义程序启动的参数 -JAVA_OPTS="-jar -server -Xms1024m -Xmx1024m -Djdchain.log=$APP_HOME/logs -Dlog4j.configurationFile=file:$APP_HOME/config/log4j2-gw.xml" +JAVA_OPTS="-jar -server -Xms1024m -Xmx1024m $opens -Djdchain.log=$APP_HOME/logs -Dlog4j.configurationFile=file:$APP_HOME/config/log4j2-gw.xml" #APP具体相关命令 APP_CMD=$APP_LIB_PATH/$APP_JAR" -c "$GATEWAY_CONFIG" -sp "$SPRING_CONFIG diff --git a/deploy/deploy-peer/pom.xml b/deploy/deploy-peer/pom.xml index 8ba408cf..e97741b2 100644 --- a/deploy/deploy-peer/pom.xml +++ b/deploy/deploy-peer/pom.xml @@ -25,11 +25,6 @@ runtime-modular-booter ${core.version} - - com.jd.blockchain - manager-booter - ${core.version} - com.jd.blockchain storage-redis diff --git a/deploy/deploy-peer/src/main/resources/assembly.xml b/deploy/deploy-peer/src/main/resources/assembly.xml index 2594ae14..0497bc79 100644 --- a/deploy/deploy-peer/src/main/resources/assembly.xml +++ b/deploy/deploy-peer/src/main/resources/assembly.xml @@ -43,18 +43,6 @@ com.jd.blockchain:deploy-peer - - false - true - manager - - com.jd.blockchain:manager-booter - com.jd.blockchain:manager-model - com.jd.blockchain:manager-service - com.jd.blockchain:manager-web - com.jd.blockchain:ump-explorer - - false true @@ -70,11 +58,6 @@ com.jd.blockchain:runtime-modular-booter com.jd.blockchain:peer com.jd.blockchain:deployment-peer - com.jd.blockchain:manager-booter - com.jd.blockchain:manager-model - com.jd.blockchain:manager-service - com.jd.blockchain:manager-web - com.jd.blockchain:ump-explorer diff --git a/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh b/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh index ecbc3e02..5f658fec 100644 --- a/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh +++ b/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh @@ -2,8 +2,18 @@ HOME=$(cd `dirname $0`;cd ../; pwd) boot_file=$(ls $HOME/libs | grep tools-initializer-booter-) +JDK_VERSION=$(java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}') +if [[ $JDK_VERSION == 1.8.* ]]; then + opens="" +else + opens="--add-opens java.base/java.lang=ALL-UNNAMED" + opens=$opens" --add-opens java.base/java.util=ALL-UNNAMED" + opens=$opens" --add-opens java.base/java.net=ALL-UNNAMED" + opens=$opens" --add-opens java.base/sun.security.x509=ALL-UNNAMED" + opens=$opens" --add-opens java.base/sun.security.util=ALL-UNNAMED" +fi if [ ! -n "$boot_file" ]; then echo "tools-initializer-booter is null" else - java -jar -server -Djdchain.log=$HOME/logs $HOME/libs/$boot_file -l $HOME/config/init/local.conf -i $HOME/config/init/ledger.init $* + java -jar -server $opens -Djdchain.log=$HOME/logs $HOME/libs/$boot_file -l $HOME/config/init/local.conf -i $HOME/config/init/ledger.init $* fi \ No newline at end of file diff --git a/deploy/deploy-peer/src/main/resources/scripts/manager-shutdown.sh b/deploy/deploy-peer/src/main/resources/scripts/manager-shutdown.sh deleted file mode 100644 index 3974ce8f..00000000 --- a/deploy/deploy-peer/src/main/resources/scripts/manager-shutdown.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -#启动Home路径 -BOOT_HOME=$(cd `dirname $0`;cd ../; pwd) - -#获取进程PID -PID=`ps -ef | grep $BOOT_HOME/manager/manager-booter | grep -v grep | awk '{print $2}'` - -#通过Kill命令将进程杀死 -if [ -z "$PID" ]; then - echo "================================" - echo "WARN: Unable to find JD Chain Manager PID($PID)." - echo "================================" -else - echo "Stopping Manager (PID = $PID) ......" - kill $PID - while kill -0 $PID 2>/dev/null; do sleep 1; done - echo "================================" - echo "Success" - echo "================================" -fi \ No newline at end of file diff --git a/deploy/deploy-peer/src/main/resources/scripts/manager-startup.sh b/deploy/deploy-peer/src/main/resources/scripts/manager-startup.sh deleted file mode 100644 index e630da5f..00000000 --- a/deploy/deploy-peer/src/main/resources/scripts/manager-startup.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -HOME=$(cd `dirname $0`;cd ../; pwd) -UMP=$(ls $HOME/manager | grep manager-booter-) -PROC_INFO=$HOME/manager/$UMP" -home "$HOME" -p 8000" -#echo $PROC_INFO -#get PID -PID=`ps -ef | grep "$PROC_INFO" | grep -v grep | awk '{print $2}'` -#echo $PID -if [[ ! -z $PID ]] -then - echo "process already exists,please check... If necessary, you should kill the process first." - exit -fi -if [ ! -n "UMP" ]; then - echo "JDChain Manager Is Null !!!" -else - nohup java -jar -server -Djdchain.log=$HOME $PROC_INFO $* >$HOME/bin/jump.out 2>&1 & -fi \ No newline at end of file diff --git a/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh b/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh index b793e4b9..5106134c 100644 --- a/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh +++ b/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh @@ -45,8 +45,19 @@ LEDGER_BINDING_CONFIG=$CONFIG_PATH/ledger-binding.conf #application-peer.properties完整路径 SPRING_CONFIG=$CONFIG_PATH/application-peer.properties +JDK_VERSION=$(java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}') +if [[ $JDK_VERSION == 1.8.* ]]; then + opens="" +else + opens="--add-opens java.base/java.lang=ALL-UNNAMED" + opens=$opens" --add-opens java.base/java.util=ALL-UNNAMED" + opens=$opens" --add-opens java.base/java.net=ALL-UNNAMED" + opens=$opens" --add-opens java.base/sun.security.x509=ALL-UNNAMED" + opens=$opens" --add-opens java.base/sun.security.util=ALL-UNNAMED" +fi + #定义程序启动的参数 -JAVA_OPTS="-jar -server -Xms2048m -Xmx2048m -Djdchain.log=$APP_HOME/logs -Dlog4j.configurationFile=file:$APP_HOME/config/log4j2-peer.xml" +JAVA_OPTS="-jar -server -Xms2048m -Xmx2048m $opens -Djdchain.log=$APP_HOME/logs -Dlog4j.configurationFile=file:$APP_HOME/config/log4j2-peer.xml" #APP具体相关命令 APP_CMD=$APP_SYSTEM_PATH/$APP_JAR" -home="$APP_HOME" -c "$LEDGER_BINDING_CONFIG" -p "$WEB_PORT" -sp "$SPRING_CONFIG diff --git a/explorer b/explorer index 371b776a..17000891 160000 --- a/explorer +++ b/explorer @@ -1 +1 @@ -Subproject commit 371b776aa045d3fac3ebc31b2ed7c3b4e98c19f8 +Subproject commit 17000891306cfa3ccd6b32cf8666531ef5ce001f diff --git a/libs/bft-smart b/libs/bft-smart index 44c1cb2e..dd5c3872 160000 --- a/libs/bft-smart +++ b/libs/bft-smart @@ -1 +1 @@ -Subproject commit 44c1cb2e9b9026229a09256491f2876778fb4c76 +Subproject commit dd5c3872ecbcbedb4c1d6fd6a34350e715fcec10 diff --git a/project b/project index e3abd91f..66876f59 160000 --- a/project +++ b/project @@ -1 +1 @@ -Subproject commit e3abd91fd2babdee6db389a74369d0afb5f392a6 +Subproject commit 66876f594a29c1b0bb5918aae76c3a7d13ba6dce