Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-5219

Provide GraalVM metadata and substitutions

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Integrations
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

    Description

      To compile a Java application using Mongo into a native executable with GraalVM, you need:
       

      • a set of metadata configuring the compiler
      • a set of substitutions that transform the code during the native compilation

      The substitutions are there to reduce the footprint of the resulting executable and workaround features not supported by the native compiler.

      This issue is about migrating substitutions and metadata available in the Quarkus Mongo extension to the Mongo Java client project. It will simplify the maintenance and will prevent changes from breaking native compilation. 

      The idea would be to:

      • include the substitutions (files attached to this issue). You will need an additional (in the provided scope) dependency: org.graalvm.sdk:graal-sdk
      • add a META-INF/mongo/native-image.properties file in one of the artifact with the following metadata:

      Add the resource: com.mongodb.spi.dns.DnsClientProvider

      Register for reflection

      • com.mongodb.client.model.changestream.ChangeStreamDocument
      • com.mongodb.client.model.changestream.UpdateDescription
      • org.bson.types.ObjectId

      Initialize at runtime:

      • org.bson.types.ObjectId 
      • com.mongodb.internal.dns.DefaultDnsResolver

       
      The GraalVM gradle plugin should allow adding a few tests to make sure it works as expected.
        
      PS: I'm the main author of the MongoDB substitution and metadata from the Quarkus extension.

      Attachments

        Activity

          People

            Unassigned Unassigned
            clement.escoffier@gmail.com clement escoffier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: