Skip to content

Commit

Permalink
Merge pull request #9 from aws-samples/graalvm_19_1_0
Browse files Browse the repository at this point in the history
Graalvm 19 1 0
  • Loading branch information
smoell authored Jul 8, 2019
2 parents b912a8b + 4bfc5e6 commit bc636d2
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 83 deletions.
6 changes: 6 additions & 0 deletions services/tracking-service/reactive-vertx/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ hs_err_pid*
.idea/misc.xml
.idea/workspace.xml
target/

# VSCode
.classpath
.project
.settings/
.vscode/
95 changes: 37 additions & 58 deletions services/tracking-service/reactive-vertx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@

<!-- the main verticle class name -->
<vertx.verticle>com.amazon.BootStrapVerticle</vertx.verticle>
<vertx.lambda.verticle>com.amazon.LambdaBootstrap</vertx.lambda.verticle>
<app.version>1.6</app.version>
<vertx.version>3.7.1</vertx.version>
<awssdk.version>2.6.2</awssdk.version>
<graal.version>19.1.0</graal.version>
<skip.native>true</skip.native>
</properties>

<profiles>
<profile>
<id>native-image-fargate</id>
<properties>
<skip.native>false</skip.native>
<vertx.verticle>com.amazon.BootStrapVerticle</vertx.verticle>
</properties>
</profile>
<profile>
<id>native-image-lambda</id>
<properties>
<skip.native>false</skip.native>
<vertx.verticle>com.amazon.LambdaBootstrap</vertx.verticle>
</properties>
</profile>
</profiles>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -174,63 +191,25 @@
<classifier>fat</classifier>
</configuration>
</plugin>
<plugin>
<groupId>com.oracle.substratevm</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>${graal.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<skip>${skip.native}</skip>
<imageName>${project.artifactId}</imageName>
<mainClass>${vertx.verticle}</mainClass>
<buildArgs>--enable-all-security-services --report-unsupported-elements-at-runtime --allow-incomplete-classpath --verbose</buildArgs>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>native-image-fargate</id>
<build>
<plugins>
<plugin>
<groupId>com.oracle.substratevm</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>${graal.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>${project.artifactId}</imageName>
<mainClass>${vertx.verticle}</mainClass>
<buildArgs>--enable-all-security-services -H:+ReportUnsupportedElementsAtRuntime --allow-incomplete-classpath</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>native-image-lambda</id>
<build>
<plugins>
<plugin>
<groupId>com.oracle.substratevm</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>${graal.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>${project.artifactId}-lambda</imageName>
<mainClass>${vertx.lambda.verticle}</mainClass>
<buildArgs>--enable-all-security-services -H:+ReportUnsupportedElementsAtRuntime --allow-incomplete-classpath</buildArgs>
<additionalBuildArgs>--no-fallback</additionalBuildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>

</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Original file line number Diff line number Diff line change
@@ -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
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
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit bc636d2

Please sign in to comment.