Procházet zdrojové kódy

update edap dependencies version (#10226)

* 初始化edap-http-benchmark的项目

* 修改pom文件以及测试的配置

* 修改端口号,jdk版本以及去掉有问题的plaintext的测试项

* 修改Message启动时初始化为每次请求生成新的对象

* 去掉多余的"s"字符

* 增加plaintext的测试配置

* add edap-http framwork

* cache plaintext's content.

* add edap-http-fast

* 解决docker构建文件编写错误

* 修改测试框架配置

* 增加dockerfile暴露端口的设置

* 增加edap-http的新版

* 完善maven快照无法下载的问题

* update edap version

* delete edapx module

* revert firenio code

* edit mvn run option

---------

Co-authored-by: louis <[email protected]>
luyongshou před 1 měsícem
rodič
revize
613eef20f0

+ 3 - 3
frameworks/Java/edap-http/edap-http-fast.dockerfile

@@ -1,13 +1,13 @@
-FROM maven:3.6.3-openjdk-8-slim as maven
+FROM maven:3.9.11-amazoncorretto-21 as maven
 WORKDIR /edap-http
 COPY pom.xml pom.xml
 COPY src src
 RUN mvn compile assembly:single -q
 
-FROM openjdk:8u275-jdk-slim
+FROM amazoncorretto:21.0.8
 WORKDIR /edap-http
 COPY --from=maven /edap-http/target/edap-http-benchmark-1.0-SNAPSHOT-jar-with-dependencies.jar app.jar
 
 EXPOSE 8080
 
-CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-Dedap.http.decoder.type=fast", "-cp", "app.jar", "io.edap.http.Bootstrap"]
+CMD ["java", "-DlazyParseHeader=true", "-server", "--add-exports", "java.base/sun.security.action=ALL-UNNAMED", "--add-exports", "java.naming/com.sun.jndi.ldap=ALL-UNNAMED", "--add-exports", "java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED", "--add-exports", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED", "--add-exports", "jdk.naming.dns/com.sun.jndi.url.dns=ALL-UNNAMED", "--add-exports", "java.security.jgss/sun.security.krb5.internal=ALL-UNNAMED", "--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED", "--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.util.concurrent=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED", "--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.naming/javax.naming.spi=ALL-UNNAMED", "--add-opens", "java.naming/com.sun.naming.internal=ALL-UNNAMED", "--add-opens", "jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED", "--add-opens", "java.naming/javax.naming=ALL-UNNAMED", "--add-opens", "java.rmi/java.rmi=ALL-UNNAMED", "--add-opens", "java.sql/java.sql=ALL-UNNAMED", "--add-opens", "java.management/javax.management=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "--add-opens", "java.desktop/java.awt.image=ALL-UNNAMED", "--add-opens", "java.base/java.security=ALL-UNNAMED", "--add-opens", "java.base/java.net=ALL-UNNAMED", "--add-opens", "java.base/java.text=ALL-UNNAMED", "--add-opens", "java.base/sun.net.www.protocol.https=ALL-UNNAMED", "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", "--add-opens", "java.base/java.lang.ref=ALL-UNNAMED", "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-cp", "app.jar", "io.edap.http.Bootstrap"]

+ 3 - 3
frameworks/Java/edap-http/edap-http.dockerfile

@@ -1,13 +1,13 @@
-FROM maven:3.6.3-openjdk-8-slim as maven
+FROM maven:3.9.11-amazoncorretto-21 as maven
 WORKDIR /edap-http
 COPY pom.xml pom.xml
 COPY src src
 RUN mvn compile assembly:single -q
 
-FROM openjdk:8u275-jdk-slim
+FROM amazoncorretto:21.0.8
 WORKDIR /edap-http
 COPY --from=maven /edap-http/target/edap-http-benchmark-1.0-SNAPSHOT-jar-with-dependencies.jar app.jar
 
 EXPOSE 8080
 
-CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-cp", "app.jar", "io.edap.http.Bootstrap"]
+CMD ["java", "-server", "--add-exports", "java.base/sun.security.action=ALL-UNNAMED", "--add-exports", "java.naming/com.sun.jndi.ldap=ALL-UNNAMED", "--add-exports", "java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED", "--add-exports", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED", "--add-exports", "jdk.naming.dns/com.sun.jndi.url.dns=ALL-UNNAMED", "--add-exports", "java.security.jgss/sun.security.krb5.internal=ALL-UNNAMED", "--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED", "--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.util.concurrent=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED", "--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.naming/javax.naming.spi=ALL-UNNAMED", "--add-opens", "java.naming/com.sun.naming.internal=ALL-UNNAMED", "--add-opens", "jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED", "--add-opens", "java.naming/javax.naming=ALL-UNNAMED", "--add-opens", "java.rmi/java.rmi=ALL-UNNAMED", "--add-opens", "java.sql/java.sql=ALL-UNNAMED", "--add-opens", "java.management/javax.management=ALL-UNNAMED", "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", "--add-opens", "java.desktop/java.awt.image=ALL-UNNAMED", "--add-opens", "java.base/java.security=ALL-UNNAMED", "--add-opens", "java.base/java.net=ALL-UNNAMED", "--add-opens", "java.base/java.text=ALL-UNNAMED", "--add-opens", "java.base/sun.net.www.protocol.https=ALL-UNNAMED", "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", "--add-opens", "java.base/java.lang.ref=ALL-UNNAMED", "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-cp", "app.jar", "io.edap.http.Bootstrap"]

+ 13 - 33
frameworks/Java/edap-http/pom.xml

@@ -11,52 +11,32 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <java.version>8</java.version>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-        <maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
+        <java.version>21</java.version>
+        <maven.compiler.source>21</maven.compiler.source>
+        <maven.compiler.target>21</maven.compiler.target>
+        <maven.compiler.compilerVersion>21</maven.compiler.compilerVersion>
         <edap.version>0.1-SNAPSHOT</edap.version>
-        <edap.name>edapx</edap.name>
+        <edap.name>edap</edap.name>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>io.edap</groupId>
-            <artifactId>${edap.name}-http</artifactId>
+            <artifactId>${edap.name}-http-server</artifactId>
             <version>${edap.version}</version>
         </dependency>
     </dependencies>
 
     <repositories>
         <repository>
-            <id>central</id>
-            <name>Central Repository</name>
-            <url>https://repo.maven.apache.org/maven2</url>
-        </repository>
-        <repository>
-            <id>sonatype-nexus-snapshots</id>
-            <name>Sonatype Nexus Snapshots</name>
-            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
-        </repository>
-    </repositories>
-    <pluginRepositories>
-        <pluginRepository>
-            <id>central</id>
-            <name>Central Repository</name>
-            <url>https://repo.maven.apache.org/maven2</url>
-        </pluginRepository>
-        <pluginRepository>
-            <id>sonatype-nexus-snapshots</id>
-            <name>Sonatype Nexus Snapshots</name>
-            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
-            <releases>
-                <enabled>false</enabled>
-            </releases>
+            <id>ossrh</id>
+            <name>ossrh</name>
+            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
             <snapshots>
                 <enabled>true</enabled>
             </snapshots>
-        </pluginRepository>
-    </pluginRepositories>
+        </repository>
+    </repositories>
     <build>
         <plugins>
 
@@ -67,8 +47,8 @@
                 <version>3.8.0</version>
                 <configuration>
                     <debug>false</debug>
-                    <source>8</source>
-                    <target>8</target>
+                    <source>21</source>
+                    <target>21</target>
                 </configuration>
             </plugin>
 

+ 15 - 8
frameworks/Java/edap-http/src/main/java/io/edap/http/Bootstrap.java

@@ -1,25 +1,32 @@
 package io.edap.http;
 
 import io.edap.http.model.Message;
-import io.edap.x.Edap;
-import io.edap.x.http.HttpServer;
-import io.edap.x.http.HttpServerBuilder;
+import io.edap.Edap;
+import io.edap.http.server.HttpServer;
+import io.edap.http.server.HttpServerBuilder;
 
 import java.io.IOException;
 
-import static io.edap.x.http.header.ContentType.JSON;
-import static io.edap.x.http.header.ContentType.PLAIN;
+import static io.edap.http.header.ContentTypeHeader.JSON;
+import static io.edap.http.header.ContentTypeHeader.PLAIN;
 
 public class Bootstrap {
 
     static final byte[] PLAIN_TEXT_CONTENT = "Hello, World!".getBytes();
 
     public static void main(String[] args) throws IOException {
-
+        HttpHandleOption option = new HttpHandleOption();
+        String lazyParseHeaderStr = System.getProperty("lazyParseHeader", "false");
+        if (Boolean.parseBoolean(lazyParseHeaderStr)) {
+            option.setLazyParseHeader(true);
+        }
         HttpServer httpServer = new HttpServerBuilder()
                 .listen(8080)
-                .req("/plaintext", (req, resp) -> resp.contentType(PLAIN).write(PLAIN_TEXT_CONTENT))
-                .get("/json", (req, resp) -> resp.contentType(JSON).write(new Message("Hello, World!")))
+                .req("/plaintext", (req, resp) ->
+						resp.contentType(PLAIN).write(PLAIN_TEXT_CONTENT), option)
+                .get("/json", (req, resp) -> {
+                    	resp.contentType(JSON).write(new Message("Hello, World!"));
+                }, option)
                 .build();
         Edap edap = new Edap();
         edap.addServer(httpServer);