소스 검색

内存优化-测试

wuweihao 3 년 전
부모
커밋
b45eead942
2개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 3
      720yun_local_manage/gis_common/src/main/java/com/gis/common/util/FileUtils.java
  2. 1 1
      startJar.sh

+ 7 - 3
720yun_local_manage/gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -2,6 +2,7 @@ package com.gis.common.util;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
 import com.gis.common.base.exception.BaseRuntimeException;
 import com.gis.common.constant.ConfigConstant;
 import lombok.extern.slf4j.Slf4j;
@@ -108,9 +109,12 @@ public class FileUtils {
      * @param path 参数是相对地址
      */
     public void del(String path){
-        String delPath = configConstant.serverBasePath + path;
-        FileUtil.del(delPath);
-        log.info("真删除文件: {}", delPath);
+        if (StrUtil.isNotBlank(path)){
+            String delPath = configConstant.serverBasePath + path;
+            FileUtil.del(delPath);
+            log.info("真删除文件: {}", delPath);
+        }
+
     }
 
     /**

+ 1 - 1
startJar.sh

@@ -97,7 +97,7 @@ restart(){
         if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号打印出来
             echo "${APP_NAME} running. pid=${pid}"
         else
-            nohup java -jar -Xmx3096M -Xms512M ./$APP_NAME --spring.profiles.active=$1 --server.port=$APP_PORT > logs.log 2>error.log &  # 说明pid为空
+            nohup java -jar -Xmx3096M -Xms512M -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=1024m ./$APP_NAME --spring.profiles.active=$1 --server.port=$APP_PORT > logs.log 2>error.log &  # 说明pid为空
             echo "${APP_NAME} started启动"
         fi
 }