From 170f0117ae2cd65ff14a7296360a5e5f7fc46b58 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Fri, 16 Feb 2024 13:41:03 +0000 Subject: [PATCH] Updates to Infinispan 15.0.0.CR1 * Next major version of Infinispan * Includes Protostream 5.0.0.CR2 major upgrade --- bom/application/pom.xml | 8 ++-- .../deployment/InfinispanClientProcessor.java | 18 ++------ extensions/infinispan-client/runtime/pom.xml | 2 +- .../runtime/graal/QuerySubstitutions.java | 27 ------------ ...teExecutorFactoryConfigurationBuilder.java | 43 ------------------- 5 files changed, 8 insertions(+), 90 deletions(-) delete mode 100644 extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/QuerySubstitutions.java delete mode 100644 extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteExecutorFactoryConfigurationBuilder.java diff --git a/bom/application/pom.xml b/bom/application/pom.xml index f75edd315dcc3..fff6721558ace 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -140,8 +140,8 @@ 5.4.0 2.2 5.10.2 - 14.0.25.Final - 4.6.5.Final + 15.0.0.CR1 + 5.0.0.CR2 3.1.5 4.1.106.Final 1.14.0 @@ -5399,7 +5399,7 @@ org.infinispan - infinispan-client-hotrod-jakarta + infinispan-client-hotrod ${infinispan.version} @@ -5442,7 +5442,7 @@ org.infinispan - infinispan-commons-jakarta + infinispan-commons ${infinispan.version} diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java index 7e11774606f90..279d2f08467ba 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java @@ -47,7 +47,6 @@ import org.infinispan.protostream.FileDescriptorSource; import org.infinispan.protostream.GeneratedSchema; import org.infinispan.protostream.MessageMarshaller; -import org.infinispan.protostream.RawProtobufMarshaller; import org.infinispan.protostream.SerializationContextInitializer; import org.infinispan.protostream.WrappedMessage; import org.jboss.jandex.AnnotationInstance; @@ -142,20 +141,7 @@ NativeImageFeatureBuildItem nativeImageFeature() { @BuildStep public void handleProtoStreamRequirements(BuildProducer protostreamPropertiesBuildItem) throws ClassNotFoundException { - // We only apply this if we are in native mode in build time to apply to the properties - // Note that the other half is done in QuerySubstitutions.SubstituteMarshallerRegistration class - // Note that the registration of these files are done twice in normal VM mode - // (once during init and once at runtime) Properties properties = new Properties(); - try { - properties.put(PROTOBUF_FILE_PREFIX + WrappedMessage.PROTO_FILE, - getContents("/" + WrappedMessage.PROTO_FILE)); - String queryProtoFile = "org/infinispan/query/remote/client/query.proto"; - properties.put(PROTOBUF_FILE_PREFIX + queryProtoFile, getContents("/" + queryProtoFile)); - } catch (Exception ex) { - // Do nothing if fails - } - Map marshallers = new HashMap<>(); initMarshaller(InfinispanClientUtil.DEFAULT_INFINISPAN_CLIENT_NAME, infinispanClientsBuildTimeConfig.defaultInfinispanClient.marshallerClass, marshallers); @@ -205,6 +191,8 @@ InfinispanPropertiesBuildItem setup(ApplicationArchivesBuildItem applicationArch additionalBeans.produce(AdditionalBeanBuildItem.builder().addBeanClass(InfinispanClientName.class).build()); additionalBeans.produce(AdditionalBeanBuildItem.builder().addBeanClass(Remote.class).build()); + resourceBuildItem.produce(new NativeImageResourceBuildItem("proto/generated/query.proto")); + resourceBuildItem.produce(new NativeImageResourceBuildItem(WrappedMessage.PROTO_FILE)); hotDeployment .produce(new HotDeploymentWatchedFileBuildItem(META_INF + File.separator + DEFAULT_HOTROD_CLIENT_PROPERTIES)); @@ -460,7 +448,7 @@ private void addMaxEntries(String clientName, InfinispanClientBuildTimeConfig co @BuildStep UnremovableBeanBuildItem ensureBeanLookupAvailable() { return UnremovableBeanBuildItem.beanTypes(BaseMarshaller.class, EnumMarshaller.class, MessageMarshaller.class, - RawProtobufMarshaller.class, FileDescriptorSource.class); + FileDescriptorSource.class); } @BuildStep diff --git a/extensions/infinispan-client/runtime/pom.xml b/extensions/infinispan-client/runtime/pom.xml index a9ff61b97ae81..ad1a959e7ad57 100644 --- a/extensions/infinispan-client/runtime/pom.xml +++ b/extensions/infinispan-client/runtime/pom.xml @@ -67,7 +67,7 @@ org.infinispan - infinispan-client-hotrod-jakarta + infinispan-client-hotrod org.infinispan diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/QuerySubstitutions.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/QuerySubstitutions.java deleted file mode 100644 index 1548c1945e48a..0000000000000 --- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/QuerySubstitutions.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.quarkus.infinispan.client.runtime.graal; - -import java.io.IOException; - -import org.infinispan.protostream.SerializationContext; -import org.infinispan.query.remote.client.impl.MarshallerRegistration; - -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -/** - * Class that has all the query substitutions necessary to remove code that is loaded when proto marshaller is in use - * - * @author William Burns - */ -final class QuerySubstitutions { -} - -@TargetClass(value = MarshallerRegistration.class) -final class SubstituteMarshallerRegistration { - @Substitute - public static void init(SerializationContext ctx) throws IOException { - // Skip loading the proto definition files as this was already done at compile time with - // HandleProtostreamMarshaller#handleQueryRequirements - MarshallerRegistration.INSTANCE.registerMarshallers(ctx); - } -} diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteExecutorFactoryConfigurationBuilder.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteExecutorFactoryConfigurationBuilder.java deleted file mode 100644 index fffc6ce238c30..0000000000000 --- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteExecutorFactoryConfigurationBuilder.java +++ /dev/null @@ -1,43 +0,0 @@ -package io.quarkus.infinispan.client.runtime.graal; - -import java.util.Properties; - -import org.infinispan.client.hotrod.configuration.ExecutorFactoryConfiguration; -import org.infinispan.client.hotrod.configuration.ExecutorFactoryConfigurationBuilder; -import org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory; -import org.infinispan.commons.executors.ExecutorFactory; -import org.infinispan.commons.util.TypedProperties; - -import com.oracle.svm.core.annotate.Alias; -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -/** - * Avoids using reflection for DefaultAsyncExecutorFactory class - * - * @author William Burns - */ -@TargetClass(ExecutorFactoryConfigurationBuilder.class) -public final class SubstituteExecutorFactoryConfigurationBuilder { - @Alias - private ExecutorFactory factory; - @Alias - private Properties properties; - - @Substitute - public SubstituteExecutorFactoryConfiguration create() { - if (factory != null) - return new SubstituteExecutorFactoryConfiguration(factory, TypedProperties.toTypedProperties(properties)); - else - return new SubstituteExecutorFactoryConfiguration(new DefaultAsyncExecutorFactory(), - TypedProperties.toTypedProperties(properties)); - } -} - -@TargetClass(ExecutorFactoryConfiguration.class) -final class SubstituteExecutorFactoryConfiguration { - @Alias - SubstituteExecutorFactoryConfiguration(ExecutorFactory factory, TypedProperties properties) { - } - -}