@echo off
@REM
@REM Copyright (c) 2018-2022
@REM Beijing Baolande Software Corporation
@REM
@REM All Rights Reserved
@REM

set DEBUG_OPTIONS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=0.0.0.0:9009
set SECURE_OPTIONS=-Djava.security.manager -Djava.security.policy="%BES_ROOT%\conf\security\server.policy"

set JAVA_OPTS=%JAVA_OPTS% -server
set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
set JAVA_OPTS=%JAVA_OPTS% -Xms256m
set JAVA_OPTS=%JAVA_OPTS% -XX:+UnlockDiagnosticVMOptions
set JAVA_OPTS=%JAVA_OPTS% -XX:+LogVMOutput
set JAVA_OPTS=%JAVA_OPTS% -XX:LogFile="%BES_ROOT%\logs\jvm.log"
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
set JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath="%BES_ROOT%\logs\dump\\"
set JAVA_OPTS=%JAVA_OPTS% -DANTLR_USE_DIRECT_CLASS_LOADING=true
set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=com.bes.enterprise.logging.BESLogManager

if not ""%1"" == ""--debug"" goto overAddDebugOptions
shift
set JAVA_OPTS=%DEBUG_OPTIONS% %JAVA_OPTS%
:overAddDebugOptions
if not ""%1"" == ""--secure"" goto overAddSecureOptions
shift
set JAVA_OPTS=%JAVA_OPTS% %SECURE_OPTIONS%
:overAddSecureOptions
if not ""%1"" == ""--verbose"" goto overAddVerboseOptions
shift
if not "%1" == "false" goto overAddVerboseOptions
set JAVA_OPTS=%JAVA_OPTS% -Dcom.bes.enterprise.log.verbose=false
:overAddVerboseOptions
set JAVA_OPTS=%JAVA_OPTS% %JVM_SUFFIX_OPTIONS%
exit /b 0