From 4183fddf66ce6b745f8aa97a190eb2c55be76744 Mon Sep 17 00:00:00 2001 From: Paulo Lopes Date: Mon, 8 Jul 2019 12:10:20 +0200 Subject: [PATCH 1/2] Fix graal build for 19.1 --- .../reactive-vertx/.gitignore | 6 ++ .../tracking-service/reactive-vertx/pom.xml | 95 ++++++++----------- .../src/main/java/graal/SVMSubstitutions.java | 16 ---- .../reactive-vertx/native-image.properties | 13 ++- .../com.amazon/reactive-vertx/reflection.json | 19 ++++ 5 files changed, 68 insertions(+), 81 deletions(-) diff --git a/services/tracking-service/reactive-vertx/.gitignore b/services/tracking-service/reactive-vertx/.gitignore index ccec225..aa15a6e 100644 --- a/services/tracking-service/reactive-vertx/.gitignore +++ b/services/tracking-service/reactive-vertx/.gitignore @@ -29,3 +29,9 @@ hs_err_pid* .idea/misc.xml .idea/workspace.xml target/ + +# VSCode +.classpath +.project +.settings/ +.vscode/ \ No newline at end of file diff --git a/services/tracking-service/reactive-vertx/pom.xml b/services/tracking-service/reactive-vertx/pom.xml index 697c4b8..d1aa307 100644 --- a/services/tracking-service/reactive-vertx/pom.xml +++ b/services/tracking-service/reactive-vertx/pom.xml @@ -18,13 +18,30 @@ com.amazon.BootStrapVerticle - com.amazon.LambdaBootstrap 1.6 3.7.1 2.6.2 19.1.0 + true + + + native-image-fargate + + false + com.amazon.BootStrapVerticle + + + + native-image-lambda + + false + com.amazon.LambdaBootstrap + + + + @@ -174,63 +191,25 @@ fat + + com.oracle.substratevm + native-image-maven-plugin + ${graal.version} + + + + native-image + + package + + + + ${skip.native} + ${project.artifactId} + ${vertx.verticle} + --enable-all-security-services --report-unsupported-elements-at-runtime --allow-incomplete-classpath --verbose + + - - - - native-image-fargate - - - - com.oracle.substratevm - native-image-maven-plugin - ${graal.version} - - - - native-image - - package - - - - ${project.artifactId} - ${vertx.verticle} - --enable-all-security-services -H:+ReportUnsupportedElementsAtRuntime --allow-incomplete-classpath - - - - - - - - native-image-lambda - - - - com.oracle.substratevm - native-image-maven-plugin - ${graal.version} - - - - native-image - - package - - - - ${project.artifactId}-lambda - ${vertx.lambda.verticle} - --enable-all-security-services -H:+ReportUnsupportedElementsAtRuntime --allow-incomplete-classpath - --no-fallback - - - - - - - - \ No newline at end of file diff --git a/services/tracking-service/reactive-vertx/src/main/java/graal/SVMSubstitutions.java b/services/tracking-service/reactive-vertx/src/main/java/graal/SVMSubstitutions.java index f9db459..9cb3156 100644 --- a/services/tracking-service/reactive-vertx/src/main/java/graal/SVMSubstitutions.java +++ b/services/tracking-service/reactive-vertx/src/main/java/graal/SVMSubstitutions.java @@ -75,22 +75,6 @@ public void beforeAnalysis(BeforeAnalysisAccess access) { RuntimeReflection.register(java.util.ArrayList.class.getDeclaredConstructor()); RuntimeReflection.register(java.util.LinkedHashMap.class.getDeclaredConstructor()); - // commands - RuntimeReflection.register(io.vertx.core.impl.launcher.commands.RunCommand.class); - RuntimeReflection.register(io.vertx.core.impl.launcher.commands.RunCommand.class.getDeclaredConstructors()); - RuntimeReflection.register(io.vertx.core.impl.launcher.commands.RunCommand.class.getDeclaredMethods()); - - RuntimeReflection.register(io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer.class); - RuntimeReflection.register(io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer.class.getDeclaredConstructors()); - RuntimeReflection.register(io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer.class.getDeclaredMethods()); - - // launcher reflection - RuntimeReflection.register(java.lang.Long.class); - RuntimeReflection.register(java.lang.Long.class.getDeclaredConstructors()); - - RuntimeReflection.register(java.lang.Integer.class); - RuntimeReflection.register(java.lang.Integer.class.getDeclaredConstructors()); - // extras (grpc seems to need this) RuntimeReflection.register(io.netty.channel.socket.nio.NioServerSocketChannel.class.getDeclaredConstructor()); diff --git a/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/native-image.properties b/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/native-image.properties index 7e33681..4d79425 100644 --- a/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/native-image.properties +++ b/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/native-image.properties @@ -1,7 +1,6 @@ -Args = --enable-url-protocols=http,https --enable-all-security-services \ - --static \ - --verbose \ - --report-unsupported-elements-at-runtime \ - --initialize-at-build-time=org.slf4j.LoggerFactory,io.netty.util.internal.MathUtil,io.netty.util.internal.PlatformDependent0,io.netty.util.internal.PlatformDependent,io.netty.util.CharsetUtil,software.amazon.awssdk.protocols.core.StringToValueConverter$SimpleStringToValue,io.netty.util.AsciiString,io.netty.handler.codec.http2.Http2CodecUtil,io.netty.handler.codec.http.HttpObjectEncoder,io.netty.handler.codec.http2.DefaultHttp2FrameWriter,io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder \ - -H:IncludeResources=(META-INF|vertx-default-jul-logging)/.* \ - -H:ReflectionConfigurationFiles=classes/${.}/reflection.json \ No newline at end of file +Args = --initialize-at-build-time=io.netty,io.vertx,com.fasterxml.jackson,org.slf4j,software.amazon.awssdk \ + --initialize-at-run-time=io.netty.handler.codec.http.HttpObjectEncoder,io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,io.netty.handler.codec.http2.Http2CodecUtil,io.netty.handler.codec.http2.DefaultHttp2FrameWriter,io.netty.handler.ssl.ReferenceCountedOpenSslServerContext,io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator,io.netty.handler.ssl.ReferenceCountedOpenSslEngine,io.netty.handler.ssl.ConscryptAlpnSslEngine,io.netty.handler.ssl.JettyNpnSslEngine,io.netty.handler.ssl.ReferenceCountedOpenSslClientContext,io.vertx.core.net.impl.transport.EpollTransport,io.vertx.core.net.impl.transport.KQueueTransport \ + --enable-url-protocols=http,https \ + -H:+UseServiceLoaderFeature \ + -H:IncludeResources=(META-INF/|vertx-default-jul-logging).* \ + -H:ReflectionConfigurationFiles=classes/${.}/reflection.json diff --git a/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/reflection.json b/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/reflection.json index 1aabc9d..175742f 100644 --- a/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/reflection.json +++ b/services/tracking-service/reactive-vertx/src/main/resources/META-INF/native-image/com.amazon/reactive-vertx/reflection.json @@ -1,4 +1,23 @@ [ + { + "name": "io.vertx.core.impl.launcher.commands.RunCommand", + "allDeclaredConstructors": true, + "allDeclaredMethods": true + }, + { + "name": "io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer", + "allDeclaredConstructors": true, + "allDeclaredMethods": true + }, + { + "name": "java.lang.Long", + "allDeclaredConstructors": true + }, + { + "name": "java.lang.Integer", + "allDeclaredConstructors": true + }, + { "name": "com.amazon.BootStrapVerticle", "allDeclaredConstructors": true, From 4bfc5e60ceffc94bd19f800e3f5a1ce27c73f5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20M=C3=B6llering?= Date: Mon, 8 Jul 2019 21:28:47 +0200 Subject: [PATCH 2/2] Added dedicated Redis client --- .../src/main/java/com/amazon/verticles/RedisVerticle.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/tracking-service/reactive-vertx/src/main/java/com/amazon/verticles/RedisVerticle.java b/services/tracking-service/reactive-vertx/src/main/java/com/amazon/verticles/RedisVerticle.java index 825beca..4c72034 100644 --- a/services/tracking-service/reactive-vertx/src/main/java/com/amazon/verticles/RedisVerticle.java +++ b/services/tracking-service/reactive-vertx/src/main/java/com/amazon/verticles/RedisVerticle.java @@ -32,7 +32,7 @@ public class RedisVerticle extends AbstractVerticle { private static final Logger LOGGER = LoggerFactory.getLogger(RedisVerticle.class); - private RedisClient redisClient; + private RedisClient redisClient, redisPubSubClient; void registerToEventBusForAdding(final EventBus eb, final RedisClient redis) { eb.consumer(Constants.REDIS_STORE_EVENTBUS_ADDRESS, message -> { @@ -131,11 +131,12 @@ public void start() { .setPort(redisPort); redisClient = RedisClient.create(vertx, config); + redisPubSubClient = RedisClient.create(vertx, config); EventBus eb = vertx.eventBus(); this.registerToEventBusForAdding(eb, redisClient); this.registerToEventBusForCacheVerticle(eb, redisClient); - this.registerToEventBusForPubSub(eb, redisClient); + this.registerToEventBusForPubSub(eb, redisPubSubClient); this.registerToEventBusForPurging(eb, redisClient); }