From 89e8005016efdd7d2cde2049b8183cac29951e67 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 16 Nov 2016 11:41:29 +0100 Subject: [PATCH] library/roles/tomcat-multiple-instances: The java heap is now set by an ad hoc variable. --- tomcat-multiple-instances/defaults/main.yml | 4 +++- tomcat-multiple-instances/templates/tomcat-default.j2 | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tomcat-multiple-instances/defaults/main.yml b/tomcat-multiple-instances/defaults/main.yml index f7a1fd2..095451a 100644 --- a/tomcat-multiple-instances/defaults/main.yml +++ b/tomcat-multiple-instances/defaults/main.yml @@ -22,7 +22,9 @@ tomcat_m_heap_size: '{{ tomcat_m_min_heap_size }}' tomcat_m_permgen_size: 512m tomcat_m_restart_timeout: 300 # -server -Djava.awt.headless=true are always used. No need to specify them -tomcat_m_java_opts: "-Xms{{ tomcat_m_min_heap_size }} -Xmx{{ tomcat_m_heap_size }} -XX:MaxPermSize={{ tomcat_m_permgen_size }}" +tomcat_m_java_opts_heap: "-Xms{{ tomcat_m_min_heap_size }} -Xmx{{ tomcat_m_heap_size }}" +tomcat_m_java_opts_permgen: "-XX:MaxPermSize={{ tomcat_m_permgen_size }}" +tomcat_m_java_opts: "{{ tomcat_m_java_opts_heap }} {{ tomcat_m_java_opts_permgen }}" tomcat_m_java_gc_opts: "-XX:+UseConcMarkSweepGC" # Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved # response time). If you use that option and you run Tomcat on a machine with diff --git a/tomcat-multiple-instances/templates/tomcat-default.j2 b/tomcat-multiple-instances/templates/tomcat-default.j2 index 0152cd9..86ecf1b 100644 --- a/tomcat-multiple-instances/templates/tomcat-default.j2 +++ b/tomcat-multiple-instances/templates/tomcat-default.j2 @@ -2,8 +2,13 @@ TOMCAT_USER={{ item.user }} TOMCAT_GROUP={{ item.user }} JAVA_HOME={{ item.java_home }} JAVA_OPTS="-server -Djava.awt.headless=true" +{% if item.java_heap is defined %} +JAVA_HEAP="{{ item.java_heap }}" +{% else %} +JAVA_HEAP="{{ tomcat_m_java_opts_heap }}" +{% endif %} {% if item.java_opts is defined %} -JAVA_OPTS="{{ item.java_opts }} $JAVA_OPTS" +JAVA_OPTS="{{ item.java_opts }} $JAVA_OPTS $JAVA_HEAP" {% endif %} {% if item.java_gc_opts is defined %} JAVA_OPTS="{{ item.java_gc_opts }} $JAVA_OPTS"