Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
fix(management-api): Set default JVM options
Browse files Browse the repository at this point in the history
  • Loading branch information
brasseld authored and aelamrani committed Jan 4, 2017
1 parent 3210323 commit 39e2ead
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
Expand Up @@ -62,6 +62,37 @@ if [ ! -f "$runjar" ]; then
fi
GRAVITEE_BOOT_CLASSPATH="$runjar"

if [ "x$GIO_MIN_MEM" = "x" ]; then
GIO_MIN_MEM=1024m
fi
if [ "x$GIO_MAX_MEM" = "x" ]; then
GIO_MAX_MEM=2048m
fi

# min and max heap sizes should be set to the same value to avoid
# stop-the-world GC pauses during resize
JAVA_OPTS="$JAVA_OPTS -Xms${GIO_MIN_MEM}"
JAVA_OPTS="$JAVA_OPTS -Xmx${GIO_MAX_MEM}"

# set to headless, just in case
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"

# Force the JVM to use IPv4 stack
if [ "x$GIO_USE_IPV4" != "x" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
fi

# Causes the JVM to dump its heap on OutOfMemory.
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
# The path to the heap dump location, note directory must exists and have enough
# space for a full heap dump.
#JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$GRAVITEE_HOME/logs/heapdump.hprof"

# Disables explicit GC
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"

# Ensure UTF-8 encoding by default (e.g. filenames)
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"

# Display our environment
echo "========================================================================="
Expand Down
Expand Up @@ -18,6 +18,37 @@ for /f %%i in ('dir ..\lib\gravitee-management-api-standalone-bootstrap-*.jar /s

set GRAVITEE_BOOT_CLASSPATH=%runjar%

if "%GIO_MIN_MEM%" == "" (
set GIO_MIN_MEM=1024m
)

if "%GIO_MAX_MEM%" == "" (
set GIO_MAX_MEM=2048m
)

REM min and max heap sizes should be set to the same value to avoid
REM stop-the-world GC pauses during resize
set JAVA_OPTS=%JAVA_OPTS% -Xms%GIO_MIN_MEM% -Xmx%GIO_MAX_MEM%

REM set to headless, just in case
set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true

REM Force the JVM to use IPv4 stack
if NOT "%ES_USE_IPV4%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -Djava.net.preferIPv4Stack=true
)

REM Causes the JVM to dump its heap on OutOfMemory.
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
REM The path to the heap dump location, note directory must exists and have enough
REM space for a full heap dump.
REM set JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$GRAVITEE_HOME/logs/heapdump.hprof

REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC

REM Ensure UTF-8 encoding by default (e.g. filenames)
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8

# Display our environment
echo "========================================================================="
Expand Down

0 comments on commit 39e2ead

Please sign in to comment.