Skip to content

Commit

Permalink
#1753 add opens module to all scripts
Browse files Browse the repository at this point in the history
improve logging
improve readability on scripts
  • Loading branch information
robfrank committed Oct 14, 2024
1 parent 6fc92e6 commit 0d0dd32
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ private void doNotCloseOnInterrupt(final FileChannel fc) {
new Class[] { interruptibleClass },
new InterruptibleInvocationHandler()));
} catch (final Exception e) {
System.err.println("Couldn't disable close on interrupt");
e.printStackTrace();
LogManager.instance().log(this, Level.SEVERE, "Couldn't disable close on interrupt", e);
}
}
}
7 changes: 6 additions & 1 deletion package/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ ENV JAVA_OPTS=" "

ENV ARCADEDB_OPTS_MEMORY="-Xms2G -Xmx2G"

ENV ARCADEDB_JMX="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9998"
ENV ARCADEDB_JMX="-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.rmi.port=9998"

RUN useradd -ms /bin/bash arcadedb

Expand Down
9 changes: 8 additions & 1 deletion package/src/main/scripts/console.bat
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ cd /d %ARCADEDB_HOME%
rem Get full command line arguments for the batch file
set CMD_LINE_ARGS=%*

set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF8 -Dpolyglot.engine.WarnInterpreterOnly=false
set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError ^
--add-exports java.management/sun.management=ALL-UNNAMED ^
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED ^
--add-opens java.base/java.nio.channels.spi=ALL-UNNAMED ^
-Dpolyglot.engine.WarnInterpreterOnly=false ^
-Djava.awt.headless=true ^
-Dfile.encoding=UTF8 ^
-Djava.util.logging.config.file=config/arcadedb-log.properties

"%JAVACMD%" ^
-client ^
Expand Down
9 changes: 8 additions & 1 deletion package/src/main/scripts/console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ fi


if [ -z "$JAVA_OPTS_SCRIPT" ] ; then
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.io=ALL-UNNAMED -Dpolyglot.engine.WarnInterpreterOnly=false -Djava.awt.headless=true -Dfile.encoding=UTF8 --illegal-access=deny"
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError \
--add-exports java.management/sun.management=ALL-UNNAMED \
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED \
--add-opens java.base/java.nio.channels.spi=ALL-UNNAMED \
-Dpolyglot.engine.WarnInterpreterOnly=false \
-Djava.awt.headless=true \
-Dfile.encoding=UTF8 \
--illegal-access=deny"
fi

if [ $# -gt 0 ] ; then
Expand Down
8 changes: 7 additions & 1 deletion package/src/main/scripts/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ else
fi

if [ -z "$JAVA_OPTS_SCRIPT" ] ; then
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF8 -Dpolyglot.engine.WarnInterpreterOnly=false"
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError \
--add-exports java.management/sun.management=ALL-UNNAMED \
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED \
--add-opens java.base/java.nio.channels.spi=ALL-UNNAMED \
-Dpolyglot.engine.WarnInterpreterOnly=false \
-Djava.awt.headless=true -Dfile.encoding=UTF8 \
-Djava.util.logging.config.file=config/arcadedb-log.properties"
fi

exec "$JAVA" $JAVA_OPTS \
Expand Down
16 changes: 14 additions & 2 deletions package/src/main/scripts/server.bat
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,24 @@ set CMD_LINE_ARGS=%*

:doneSetArgs

set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError --add-exports java.management/sun.management=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED -Dpolyglot.engine.WarnInterpreterOnly=false -Djava.awt.headless=true -Dfile.encoding=UTF8 -Djava.util.logging.config.file=config/arcadedb-log.properties
set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError ^
--add-exports java.management/sun.management=ALL-UNNAMED ^
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED ^
--add-opens java.base/java.nio.channels.spi=ALL-UNNAMED ^
-Dpolyglot.engine.WarnInterpreterOnly=false ^
-Djava.awt.headless=true ^
-Dfile.encoding=UTF8 ^
-Djava.util.logging.config.file=config/arcadedb-log.properties

rem ARCADEDB memory options, default uses the available RAM. To set it to a specific value, like 2GB of heap, use "-Xms2G -Xmx2G"
set ARCADEDB_OPTS_MEMORY=

set ARCADEDB_JMX=-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9998
set ARCADEDB_JMX=-Dcom.sun.management.jmxremote=true ^
-Dcom.sun.management.jmxremote.local.only=false ^
-Dcom.sun.management.jmxremote.authenticate=false ^
-Dcom.sun.management.jmxremote.ssl=false ^
-Dcom.sun.management.jmxremote.port=9999 ^
-Dcom.sun.management.jmxremote.rmi.port=9998

rem TO DEBUG ARCADEDB SERVER RUN IT WITH THESE OPTIONS:
rem -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
Expand Down
15 changes: 13 additions & 2 deletions package/src/main/scripts/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,22 @@ if [ -z "$ARCADEDB_OPTS_MEMORY" ]; then
fi

if [ -z "$JAVA_OPTS_SCRIPT" ]; then
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError --add-exports java.management/sun.management=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED -Dpolyglot.engine.WarnInterpreterOnly=false -Djava.awt.headless=true -Dfile.encoding=UTF8 -Djava.util.logging.config.file=config/arcadedb-log.properties"
JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError \
--add-exports java.management/sun.management=ALL-UNNAMED \
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED \
--add-opens java.base/java.nio.channels.spi=ALL-UNNAMED \
-Dpolyglot.engine.WarnInterpreterOnly=false \
-Djava.awt.headless=true -Dfile.encoding=UTF8 \
-Djava.util.logging.config.file=config/arcadedb-log.properties"
fi

if [ -z "$ARCADEDB_JMX" ]; then
ARCADEDB_JMX="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9998"
ARCADEDB_JMX="-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.rmi.port=9998"
fi

echo $$ >$ARCADEDB_PID
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
<argLine>
--add-exports java.management/sun.management=ALL-UNNAMED
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens java.base/java.nio.channels.spi=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
Expand Down

0 comments on commit 0d0dd32

Please sign in to comment.