This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
     new b518087c1 [Improve] jvm opt improvement (#4010)
b518087c1 is described below

commit b518087c17121cbd3ab73f3172bab1f9ff5fbcb5
Author: benjobs <[email protected]>
AuthorDate: Fri Aug 30 23:41:53 2024 +0800

    [Improve] jvm opt improvement (#4010)
---
 .../src/main/assembly/bin/jvm_opts.sh              |  4 --
 .../src/main/assembly/bin/streampark.sh            | 47 ++++++++--------------
 .../console/system/runner/StartedUpRunner.java     |  1 +
 3 files changed, 18 insertions(+), 34 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh
 
b/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh
index 9a7bdff7d..f85da5375 100644
--- 
a/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh
@@ -33,7 +33,3 @@
 -XX:+UseGCLogFileRotation
 -XX:GCLogFileSize=50M
 -XX:NumberOfGCLogFiles=10
-
-# solved jdk1.8+ dynamic loading of resources to the classpath issue, if jdk > 
1.8, you can enable this parameter
-#--add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens 
jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED
-
diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
 
b/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
index dbb0f2153..d74c8ca5e 100755
--- 
a/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
@@ -229,6 +229,17 @@ if ${cygwin}; then
   CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
 fi
 
+# get jdk version, return version as an Integer.
+JDK_VERSION=$("$_RUNJAVA" -version 2>&1 | grep -i 'version' | head -n 1 | cut 
-d '"' -f 2)
+MAJOR_VER=$(echo "$JDK_VERSION" 2>&1 | cut -d '.' -f 1)
+[[ $MAJOR_VER -eq 1 ]] && MAJOR_VER=$(echo "$JDK_VERSION" 2>&1 | cut -d '.' -f 
2)
+MIN_VERSION=8
+
+if [[ $MAJOR_VER -lt $MIN_VERSION ]]; then
+  echo "JDK Version: \"${JDK_VERSION}\", the version cannot be lower than 1.8"
+  exit 1
+fi
+
 if [[ -z "$USE_NOHUP" ]]; then
   if $hpux; then
     USE_NOHUP="true"
@@ -257,7 +268,6 @@ fi
 
 BASH_UTIL="org.apache.streampark.console.base.util.BashJavaUtils"
 APP_MAIN="org.apache.streampark.console.StreamParkConsoleBootstrap"
-SERVER_PORT=$($_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --get_yaml "server.port" 
"$CONFIG")
 JVM_OPTS_FILE=${APP_HOME}/bin/jvm_opts.sh
 
 JVM_ARGS=""
@@ -270,11 +280,12 @@ if [[ -f $JVM_OPTS_FILE ]]; then
   done < $JVM_OPTS_FILE
 fi
 
-JVM_OPTS=${JVM_OPTS:-"${JVM_ARGS}"}
-JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=${APP_HOME}/logs/dump.hprof"
-JVM_OPTS="$JVM_OPTS -Xloggc:${APP_HOME}/logs/gc.log"
-DEBUG_OPTS=""
+JAVA_OPTS=${JAVA_OPTS:-"${JVM_ARGS}"}
+JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=${APP_HOME}/logs/dump.hprof"
+JAVA_OPTS="$JAVA_OPTS -Xloggc:${APP_HOME}/logs/gc.log"
+[[ $MAJOR_VER -gt $MIN_VERSION ]] && JAVA_OPTS="$JAVA_OPTS --add-opens 
java.base/jdk.internal.loader=ALL-UNNAMED --add-opens 
jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED"
 
+SERVER_PORT=$($_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --get_yaml "server.port" 
"$CONFIG")
 # ----- Execute The Requested Command -----------------------------------------
 
 print_logo() {
@@ -399,11 +410,6 @@ start() {
     APP_CLASSPATH+=":${HADOOP_HOME}/etc/hadoop"
   fi
 
-  # shellcheck disable=SC2034
-  # shellcheck disable=SC2006
-  # shellcheck disable=SC2155
-  local JAVA_OPTS="$JVM_OPTS $DEBUG_OPTS"
-
   echo_g "JAVA_OPTS:  ${JAVA_OPTS}"
 
   eval $NOHUP $_RUNJAVA $JAVA_OPTS \
@@ -468,9 +474,7 @@ start_docker() {
     APP_CLASSPATH+=":${HADOOP_HOME}/etc/hadoop"
   fi
 
-  JVM_OPTS="${JVM_OPTS} -XX:-UseContainerSupport"
-
-  local JAVA_OPTS="$JVM_OPTS $DEBUG_OPTS"
+  JAVA_OPTS="$JAVA_OPTS -XX:-UseContainerSupport"
 
   echo_g "JAVA_OPTS:  ${JAVA_OPTS}"
 
@@ -483,18 +487,6 @@ start_docker() {
 
 }
 
-debug() {
-  # shellcheck disable=SC2236
-  if [[ ! -n "$DEBUG_PORT" ]]; then
-    echo_r "If start with debug mode,Please fill in the debug port like: bash 
streampark.sh debug 10002 "
-  else
-    DEBUG_OPTS="""
-    -Xdebug  
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$DEBUG_PORT
-    """
-    start
-  fi
-}
-
 # shellcheck disable=SC2120
 stop() {
   # shellcheck disable=SC2155
@@ -566,10 +558,6 @@ restart() {
 
 main() {
   case "$1" in
-    "debug")
-        DEBUG_PORT=$2
-        debug
-        ;;
     "start")
         shift
         start "$@"
@@ -599,7 +587,6 @@ main() {
         echo_w "  stop                      Stop StreamPark, wait up to 3 
seconds and then use kill -KILL if still running"
         echo_w "  start_docker              start in docker or k8s mode"
         echo_w "  status                    StreamPark status"
-        echo_w "  debug                     StreamPark start with debug 
mode,start debug mode, like: bash streampark.sh debug 10002"
         echo_w "  restart \$conf            restart StreamPark with 
application config."
         exit 0
         ;;
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/runner/StartedUpRunner.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/runner/StartedUpRunner.java
index eba48034a..2b94e467a 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/runner/StartedUpRunner.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/runner/StartedUpRunner.java
@@ -51,6 +51,7 @@ public class StartedUpRunner implements ApplicationRunner {
       System.out.println("    WebSite:  https://streampark.apache.org          
                 ");
       System.out.println("    GitHub :  
https://github.com/apache/incubator-streampark          ");
       System.out.println("    Info   :  streampark-console start successful    
                 ");
+      System.out.println("    JDK    :  " + 
System.getProperty("java.version"));
       System.out.println("    Local  :  http://localhost:"; + port);
       System.out.println("    Time   :  " + LocalDateTime.now() + "\n\n");
       System.setProperty("streampark.start.timestamp", 
System.currentTimeMillis() + "");

Reply via email to