Browse Source

Upgrade to Helidon 2.2.1 (#6374)

* Upgrade Helidon to 2.2.1. Adjust some JVM args.

* Update Helidon version to 2.2.1
Joe DiPol 4 years ago
parent
commit
20140bc9ca

+ 1 - 1
frameworks/Java/helidon/README.md

@@ -32,7 +32,7 @@ There is currently one repository implementation.
 ## Versions
 ## Versions
 
 
 * [Java OpenJDK 11](http://openjdk.java.net/)
 * [Java OpenJDK 11](http://openjdk.java.net/)
-* [Helidon 1.4.0](http://helidon.io/)
+* [Helidon 2.2.1](http://helidon.io/)
 
 
 ## Test URLs
 ## Test URLs
 
 

+ 1 - 1
frameworks/Java/helidon/helidon.dockerfile

@@ -11,4 +11,4 @@ COPY --from=maven /helidon/target/benchmark.jar app.jar
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
-CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-Dlogging.level.root=DEBUG", "-jar", "app.jar"]
+CMD ["java", "-server", "-XX:-UseBiasedLocking", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-jar", "app.jar"]

+ 29 - 103
frameworks/Java/helidon/pom.xml

@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 <!--
-
-    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2021 Oracle and/or its affiliates.
 
 
     Licensed under the Apache License, Version 2.0 (the "License");
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     you may not use this file except in compliance with the License.
@@ -14,11 +13,17 @@
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     See the License for the specific language governing permissions and
     limitations under the License.
     limitations under the License.
-
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <modelVersion>4.0.0</modelVersion>
-
+    <parent>
+        <groupId>io.helidon.applications</groupId>
+        <artifactId>helidon-se</artifactId>
+        <version>2.2.1</version>
+        <relativePath/>
+    </parent>
     <groupId>io.helidon</groupId>
     <groupId>io.helidon</groupId>
     <artifactId>benchmark</artifactId>
     <artifactId>benchmark</artifactId>
     <version>1.0-SNAPSHOT</version>
     <version>1.0-SNAPSHOT</version>
@@ -26,114 +31,21 @@
     <name>${project.artifactId}</name>
     <name>${project.artifactId}</name>
 
 
     <properties>
     <properties>
-        <helidon.version>1.4.0</helidon.version>
-        <!-- Default package. Will be overriden by Maven archetype -->
-        <package>io.helidon.examples.quickstart.se</package>
         <mainClass>io.helidon.benchmark.Main</mainClass>
         <mainClass>io.helidon.benchmark.Main</mainClass>
-        <maven.compiler.source>11</maven.compiler.source>
-        <maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
-        <libs.classpath.prefix>libs</libs.classpath.prefix>
-        <copied.libs.dir>${project.build.directory}/${libs.classpath.prefix}</copied.libs.dir>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <argLine>-Dfile.encoding=UTF-8</argLine>
     </properties>
     </properties>
 
 
-    <build>
-        <finalName>${project.artifactId}</finalName>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-compiler-plugin</artifactId>
-                    <version>3.8.0</version>
-                    <configuration>
-                        <debug>false</debug>
-                    </configuration>
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-dependency-plugin</artifactId>
-                    <version>3.1.1</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-resources-plugin</artifactId>
-                    <version>3.1.0</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-jar-plugin</artifactId>
-                    <version>3.1.1</version>
-                    <configuration>
-                        <archive>
-                            <manifest>
-                                <addClasspath>true</addClasspath>
-                                <classpathPrefix>${libs.classpath.prefix}</classpathPrefix>
-                                <mainClass>${mainClass}</mainClass>
-                            </manifest>
-                        </archive>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-dependencies</id>
-                        <phase>prepare-package</phase>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${copied.libs.dir}</outputDirectory>
-                            <overWriteReleases>false</overWriteReleases>
-                            <overWriteSnapshots>false</overWriteSnapshots>
-                            <overWriteIfNewer>true</overWriteIfNewer>
-                            <overWriteIfNewer>true</overWriteIfNewer>
-                            <includeScope>runtime</includeScope>
-                            <excludeScope>test</excludeScope>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
     <dependencyManagement>
     <dependencyManagement>
         <dependencies>
         <dependencies>
-            <dependency>
-                <groupId>io.helidon</groupId>
-                <artifactId>helidon-bom</artifactId>
-                <version>${helidon.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
             <dependency>
             <dependency>
                 <groupId>io.reactivex.rxjava2</groupId>
                 <groupId>io.reactivex.rxjava2</groupId>
                 <artifactId>rxjava</artifactId>
                 <artifactId>rxjava</artifactId>
                 <version>2.2.8</version>
                 <version>2.2.8</version>
             </dependency>
             </dependency>
-            <dependency>
-                <groupId>com.zaxxer</groupId>
-                <artifactId>HikariCP</artifactId>
-                <version>3.3.1</version>
-            </dependency>
             <dependency>
             <dependency>
                 <groupId>com.github.spullara.mustache.java</groupId>
                 <groupId>com.github.spullara.mustache.java</groupId>
                 <artifactId>compiler</artifactId>
                 <artifactId>compiler</artifactId>
                 <version>0.9.6</version>
                 <version>0.9.6</version>
             </dependency>
             </dependency>
-            <dependency>
-                <groupId>org.postgresql</groupId>
-                <artifactId>postgresql</artifactId>
-                <version>42.2.5</version>
-                <scope>runtime</scope>
-            </dependency>
         </dependencies>
         </dependencies>
     </dependencyManagement>
     </dependencyManagement>
 
 
@@ -143,12 +55,12 @@
             <artifactId>helidon-webserver</artifactId>
             <artifactId>helidon-webserver</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
-            <groupId>io.helidon.config</groupId>
-            <artifactId>helidon-config-yaml</artifactId>
+            <groupId>io.helidon.media</groupId>
+            <artifactId>helidon-media-jsonp</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
-            <groupId>io.helidon.media.jsonp</groupId>
-            <artifactId>helidon-media-jsonp-server</artifactId>
+            <groupId>io.helidon.config</groupId>
+            <artifactId>helidon-config-yaml</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>io.reactivex.rxjava2</groupId>
             <groupId>io.reactivex.rxjava2</groupId>
@@ -167,4 +79,18 @@
             <artifactId>postgresql</artifactId>
             <artifactId>postgresql</artifactId>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-libs</id>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>
 </project>

+ 6 - 6
frameworks/Java/helidon/src/main/java/io/helidon/benchmark/Main.java

@@ -28,8 +28,8 @@ import io.helidon.benchmark.services.FortuneService;
 import io.helidon.benchmark.services.JsonService;
 import io.helidon.benchmark.services.JsonService;
 import io.helidon.benchmark.services.PlainTextService;
 import io.helidon.benchmark.services.PlainTextService;
 import io.helidon.config.Config;
 import io.helidon.config.Config;
+import io.helidon.media.jsonp.JsonpSupport;
 import io.helidon.webserver.Routing;
 import io.helidon.webserver.Routing;
-import io.helidon.webserver.ServerConfiguration;
 import io.helidon.webserver.WebServer;
 import io.helidon.webserver.WebServer;
 import io.reactivex.Scheduler;
 import io.reactivex.Scheduler;
 import io.reactivex.schedulers.Schedulers;
 import io.reactivex.schedulers.Schedulers;
@@ -117,11 +117,11 @@ public final class Main {
         // By default this will pick up application.yaml from the classpath
         // By default this will pick up application.yaml from the classpath
         Config config = Config.create();
         Config config = Config.create();
 
 
-        // Get webserver config from the "server" section of application.yaml
-        ServerConfiguration serverConfig =
-                ServerConfiguration.create(config.get("server"));
-
-        WebServer server = WebServer.create(serverConfig, createRouting(config));
+        // Build server with JSONP support
+        WebServer server = WebServer.builder(createRouting(config))
+                .config(config.get("server"))
+                .addMediaSupport(JsonpSupport.create())
+                .build();
 
 
         // Start the server and print some info.
         // Start the server and print some info.
         server.start().thenAccept(ws -> {
         server.start().thenAccept(ws -> {

+ 0 - 4
frameworks/Java/helidon/src/main/java/io/helidon/benchmark/services/DbService.java

@@ -16,7 +16,6 @@ import javax.json.JsonWriterFactory;
 import io.helidon.benchmark.models.DbRepository;
 import io.helidon.benchmark.models.DbRepository;
 import io.helidon.benchmark.models.World;
 import io.helidon.benchmark.models.World;
 import io.helidon.common.http.Parameters;
 import io.helidon.common.http.Parameters;
-import io.helidon.media.jsonp.server.JsonSupport;
 import io.helidon.webserver.Routing;
 import io.helidon.webserver.Routing;
 import io.helidon.webserver.ServerRequest;
 import io.helidon.webserver.ServerRequest;
 import io.helidon.webserver.ServerResponse;
 import io.helidon.webserver.ServerResponse;
@@ -39,9 +38,6 @@ public class DbService implements Service {
 
 
     @Override
     @Override
     public void update(Routing.Rules rules) {
     public void update(Routing.Rules rules) {
-        rules.register("/db", JsonSupport.create());
-        rules.register("/queries", JsonSupport.create());
-        rules.register("/updates", JsonSupport.create());
         rules.get("/db", this::db);
         rules.get("/db", this::db);
         rules.get("/queries", this::queries);
         rules.get("/queries", this::queries);
         rules.get("/updates", this::updates);
         rules.get("/updates", this::updates);

+ 0 - 2
frameworks/Java/helidon/src/main/java/io/helidon/benchmark/services/JsonService.java

@@ -5,7 +5,6 @@ import java.util.Collections;
 import javax.json.Json;
 import javax.json.Json;
 import javax.json.JsonBuilderFactory;
 import javax.json.JsonBuilderFactory;
 
 
-import io.helidon.media.jsonp.server.JsonSupport;
 import io.helidon.webserver.Routing;
 import io.helidon.webserver.Routing;
 import io.helidon.webserver.Service;
 import io.helidon.webserver.Service;
 
 
@@ -19,7 +18,6 @@ public class JsonService implements Service {
 
 
     @Override
     @Override
     public void update(Routing.Rules rules) {
     public void update(Routing.Rules rules) {
-        rules.register("/json", JsonSupport.create());
         rules.get("/json",
         rules.get("/json",
                 (req, res) -> res.send(jsonBuilderFactory.createObjectBuilder(Collections.singletonMap("message", "Hello, World!")).build()));
                 (req, res) -> res.send(jsonBuilderFactory.createObjectBuilder(Collections.singletonMap("message", "Hello, World!")).build()));
     }
     }