From 3a926d308035b06eb32a7fadb75d7b12772479fb Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 17 Jan 2017 12:46:25 +0100 Subject: [PATCH] library/roles/tomcat-multiple-instances: Do not set the Permgen size option if the jdk version is >=8. --- tomcat-multiple-instances/defaults/main.yml | 2 +- tomcat-multiple-instances/templates/tomcat-default.j2 | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tomcat-multiple-instances/defaults/main.yml b/tomcat-multiple-instances/defaults/main.yml index 911cb6b..8dac1fa 100644 --- a/tomcat-multiple-instances/defaults/main.yml +++ b/tomcat-multiple-instances/defaults/main.yml @@ -24,7 +24,7 @@ tomcat_m_restart_timeout: 300 # -server -Djava.awt.headless=true are always used. No need to specify them 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_permgen }}" +tomcat_m_java_opts: "" 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 fbed83f..b976b2a 100644 --- a/tomcat-multiple-instances/templates/tomcat-default.j2 +++ b/tomcat-multiple-instances/templates/tomcat-default.j2 @@ -7,8 +7,16 @@ JAVA_HEAP="{{ item.java_heap }}" {% else %} JAVA_HEAP="{{ tomcat_m_java_opts_heap }}" {% endif %} +JAVA_PERMGEN= +{% if jdk_default <= 7 %} +{% if item.java_permgen_size is defined %} +JAVA_PERMGEN="-XX:MaxPermSize={{ item.java_permgen_size }}" +{% else %} +JAVA_PERMGEN="-XX:MaxPermSize={{ tomcat_m_permgen_size }}" +{% endif %} +{% endif %} {% if item.java_opts is defined %} -JAVA_OPTS="{{ item.java_opts }} $JAVA_OPTS $JAVA_HEAP" +JAVA_OPTS="{{ item.java_opts }} $JAVA_OPTS $JAVA_HEAP $JAVA_PERMGEN" {% endif %} {% if item.java_gc_opts is defined %} JAVA_OPTS="{{ item.java_gc_opts }} $JAVA_OPTS"