You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/05/05 12:30:41 UTC

[tomcat] branch master updated: Add GraalCompat for native images

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b861be2  Add GraalCompat for native images
b861be2 is described below

commit b861be2d5f341c308322f6de88e310b42437f27e
Author: remm <re...@apache.org>
AuthorDate: Sun May 5 14:30:29 2019 +0200

    Add GraalCompat for native images
    
    Many more obscure features are never going to be supported, including in
    particular the URL caching disabling trick, so this needs its own
    JreCompat class.
---
 .../org/apache/tomcat/util/compat/GraalCompat.java | 41 ++++++++++++++++++++++
 java/org/apache/tomcat/util/compat/JreCompat.java  |  5 ++-
 webapps/docs/changelog.xml                         |  8 ++++-
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/GraalCompat.java b/java/org/apache/tomcat/util/compat/GraalCompat.java
new file mode 100644
index 0000000..0ad3a40
--- /dev/null
+++ b/java/org/apache/tomcat/util/compat/GraalCompat.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.compat;
+
+import java.io.IOException;
+
+class GraalCompat extends JreCompat {
+
+    private static final boolean GRAAL;
+
+    static {
+        GRAAL = (System.getProperty("java.runtime.version") == null);
+    }
+
+
+    static boolean isSupported() {
+        // This property does not exist for a native image
+        return GRAAL;
+    }
+
+
+    @Override
+    public void disableCachingForJarUrlConnections() throws IOException {
+    }
+
+
+}
diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java b/java/org/apache/tomcat/util/compat/JreCompat.java
index 5e7fc68..f507b11 100644
--- a/java/org/apache/tomcat/util/compat/JreCompat.java
+++ b/java/org/apache/tomcat/util/compat/JreCompat.java
@@ -44,7 +44,10 @@ public class JreCompat {
     static {
         // This is Tomcat 9 with a minimum Java version of Java 8.
         // Look for the highest supported JVM first
-        if (Jre9Compat.isSupported()) {
+        if (GraalCompat.isSupported()) {
+            instance = new GraalCompat();
+            jre9Available = false;
+        } else if (Jre9Compat.isSupported()) {
             instance = new Jre9Compat();
             jre9Available = true;
         } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b35610c..af33b14 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -47,7 +47,13 @@
 <section name="Tomcat 9.0.21 (markt)" rtext="in development">
   <subsection name="Other">
     <changelog>
-      <update>Switch from FindBugs to SpotBugs. (fschumacher)</update>
+      <update>
+        Switch from FindBugs to SpotBugs. (fschumacher)
+      </update>
+      <update>
+        Start Graal native image compatibility. Support is initially targeted
+        using the tomcat-native packaging. (remm)
+      </update>
     </changelog>
   </subsection>
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] branch master updated: Add GraalCompat for native images

Posted by Rainer Jung <ra...@kippdata.de>.
Am 05.05.2019 um 14:30 schrieb remm@apache.org:
> This is an automated email from the ASF dual-hosted git repository.
> 
> remm pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this push:
>       new b861be2  Add GraalCompat for native images
> b861be2 is described below
> 
> commit b861be2d5f341c308322f6de88e310b42437f27e
> Author: remm <re...@apache.org>
> AuthorDate: Sun May 5 14:30:29 2019 +0200
> 
>      Add GraalCompat for native images
>      
>      Many more obscure features are never going to be supported, including in
>      particular the URL caching disabling trick, so this needs its own
>      JreCompat class.
> ---
>   .../org/apache/tomcat/util/compat/GraalCompat.java | 41 ++++++++++++++++++++++
>   java/org/apache/tomcat/util/compat/JreCompat.java  |  5 ++-
>   webapps/docs/changelog.xml                         |  8 ++++-
>   3 files changed, 52 insertions(+), 2 deletions(-)
> 
...
> diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
> index b35610c..af33b14 100644
> --- a/webapps/docs/changelog.xml
> +++ b/webapps/docs/changelog.xml
> @@ -47,7 +47,13 @@
>   <section name="Tomcat 9.0.21 (markt)" rtext="in development">
>     <subsection name="Other">
>       <changelog>
> -      <update>Switch from FindBugs to SpotBugs. (fschumacher)</update>
> +      <update>
> +        Switch from FindBugs to SpotBugs. (fschumacher)
> +      </update>

Oups, unrelated and already in there, directly above but with different 
formatting.

> +      <update>
> +        Start Graal native image compatibility. Support is initially targeted
> +        using the tomcat-native packaging. (remm)
> +      </update>
>       </changelog>
>     </subsection>
>   </section>

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org