Skip to content

Commit

Permalink
Allow setting java_opts only (#343)
Browse files Browse the repository at this point in the history
* Allow setting java_opts only

This PR allows users to not use java_xmx, java_xms, java_maxmetaspacesize,
but add all Java Options to java_opts instead.

fixes: 342

Signed-off-by: Martin Alfke <[email protected]>

* Fix closing quotes

Signed-off-by: Martin Alfke <[email protected]>

* Use individual or generic java opts in domain conf

- fix handling of Array java_opts in standalone conf

Signed-off-by: Martin Alfke <[email protected]>

* Fix variable name

Signed-off-by: Martin Alfke <[email protected]>

* Update REFERENCE.md

Signed-off-by: Martin Alfke <[email protected]>

* Update README regarding parameter change

Signed-off-by: Martin Alfke <[email protected]>

* Typo in README

Signed-off-by: Martin Alfke <[email protected]>

* Switch behavior

- reenable default values
- check in template if parameter is set to empty string

Signed-off-by: Martin Alfke <[email protected]>

* Remove unneeded toc line

Signed-off-by: Martin Alfke <[email protected]>

---------

Signed-off-by: Martin Alfke <[email protected]>
  • Loading branch information
tuxmea authored Oct 29, 2024
1 parent 102f4f0 commit 36a0c2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
11 changes: 10 additions & 1 deletion templates/domain.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ fi
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %> -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
JAVA_OPTS=$JAVA_OPTS"
<%- unless $wildfly::java_xms == '' { -%>
JAVA_OPTS="$JAVA_OPTS -Xms <%= $wildfly::java_xms %>"
<%- } -%>
<%- unless $wildfly::java_xmx == '' { -%>
JAVA_OPTS="$JAVA_OPTS -Xmx <%= $wildfly::java_xmx %>"
<%- } -%>
<%- unless $wildfly::java_maxmetaspace_size == '' { -%>
JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
<%- } -%>
JAVA_OPTS="$JAVA_OPTS <% if $wildfly::java_opts =~ Array { -%>
<%= $wildfly::java_opts.join(" ") -%>
<% } elsif $wildfly::java_opts =~ String { -%>
Expand Down
17 changes: 15 additions & 2 deletions templates/standalone.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,21 @@ fi
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %> -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
JAVA_OPTS="$JAVA_OPTS <%= $wildfly::java_opts %>"
JAVA_OPTS="$JAVA_OPTS"
<%- unless $wildfly::java_xms == '' { -%>
JAVA_OPTS="$JAVA_OPTS -Xms<%= $wildfly::java_xms %>"
<%- } -%>
<%- unless $wildfly::java_xmx == '' { -%>
JAVA_OPTS="$JAVA_OPTS -Xmx<%= $wildfly::java_xmx %>"
<%- } -%>
<%- unless $wildfly::java_maxmetaspace_size == '' { -%>
JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
<%- } -%>
JAVA_OPTS="$JAVA_OPTS <% if $wildfly::java_opts =~ Array { -%>
<%= $wildfly::java_opts.join(" ") -%>
<% } elsif $wildfly::java_opts =~ String { -%>
<%= $wildfly::java_opts -%>
<% } -%>"
else
echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi
Expand Down

0 comments on commit 36a0c2c

Please sign in to comment.