[cxf] branch master updated: [CXF-7967] Ability to skip the garbage collection in maven plugins

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch master updated: [CXF-7967] Ability to skip the garbage collection in maven plugins

Guillaume Nodet-2
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 826c5e3  [CXF-7967] Ability to skip the garbage collection in maven plugins
826c5e3 is described below

commit 826c5e37ed7488c7315c69f920aad71b57ee7bd0
Author: Guillaume Nodet <[hidden email]>
AuthorDate: Mon Feb 11 11:54:10 2019 +0100

    [CXF-7967] Ability to skip the garbage collection in maven plugins
---
 .../main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java  | 13 ++++++++++++-
 .../org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java   |  7 ++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
index 5bca631..a35eb3b 100644
--- a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
+++ b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
@@ -223,6 +223,15 @@ public class Java2WSMojo extends AbstractMojo {
      */
     private Boolean classpathAsEnvVar;
 
+    /**
+     * Disable garbage collection at the end of the execution.
+     *
+     * @parameter expression="${cxf.skipGarbageCollection}" default-value="false"
+     * @since 3.3.1
+     */
+    private boolean skipGarbageCollection;
+
+
     public void execute() throws MojoExecutionException {
         boolean requiresModules = JavaUtils.isJava9Compatible();
         if (requiresModules) {
@@ -275,7 +284,9 @@ public class Java2WSMojo extends AbstractMojo {
             classLoaderSwitcher.restoreClassLoader();
         }
 
-        System.gc();
+        if (!skipGarbageCollection) {
+            System.gc();
+        }
     }
 
     private List<String> initArgs(String cp) {
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java
index 9f71705..e2b9aae 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/WADL2JavaMojo.java
@@ -52,6 +52,9 @@ public class WADL2JavaMojo extends AbstractCodeGeneratorMojo {
     @Parameter(property = "cxf.testWadlRoot", defaultValue = "${basedir}/src/test/resources/wadl")
     File testWadlRoot;
 
+    @Parameter(property = "cxf.skipGarbageCollection", defaultValue = "false")
+    boolean skipGarbageCollection;
+
 
     @Component
     BuildContext buildContext;
@@ -142,7 +145,9 @@ public class WADL2JavaMojo extends AbstractCodeGeneratorMojo {
             classLoaderSwitcher.restoreClassLoader();
         }
 
-        System.gc();
+        if (!skipGarbageCollection) {
+            System.gc();
+        }
     }
 
     /**