From bbe2c4df26b087520d2f33cb437d59629fcc0a11 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Wed, 14 Apr 2021 15:20:12 +0200 Subject: [PATCH] Upgrade to 12.1.1.Final --- bom/application/pom.xml | 9 ++++++-- docs/src/main/asciidoc/infinispan-client.adoc | 21 ++++--------------- .../deployment/InfinispanClientProcessor.java | 3 --- ...=> SubstituteDefaultTransportFactory.java} | 11 +++++----- .../graal/SubstituteRemoteCacheImpl.java | 4 +--- .../graal/SubstituteRemoteCacheManager.java | 5 ++++- .../infinispan/client/BigDecimalAdapter.java | 21 ------------------- .../client/BookContextInitializer.java | 1 + 8 files changed, 23 insertions(+), 52 deletions(-) rename extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/{SubstituteTransportHelper.java => SubstituteDefaultTransportFactory.java} (69%) delete mode 100644 integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BigDecimalAdapter.java diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 2df722ca0aec1..321dd0e7de7db 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -133,8 +133,8 @@ 6.14.2 3.19.0 2.3 - 12.0.1.Final - 4.4.0.Alpha4 + 12.1.1.Final + 4.4.0.Final 2.9.0 4.1.60.Final 1.0.3 @@ -4596,6 +4596,11 @@ protostream-processor ${infinispan.protostream.version} + + org.infinispan.protostream + protostream-types + ${infinispan.protostream.version} + org.infinispan.protostream protostream diff --git a/docs/src/main/asciidoc/infinispan-client.adoc b/docs/src/main/asciidoc/infinispan-client.adoc index 97a4d191b725c..562510f885821 100644 --- a/docs/src/main/asciidoc/infinispan-client.adoc +++ b/docs/src/main/asciidoc/infinispan-client.adoc @@ -147,23 +147,6 @@ Here is an example of how the preceding classes should be changed: } ---- -.BigDecimalAdapter.java -[source,java] ----- -@ProtoAdapter(BigDecimal.class) -public class BigDecimalAdapter { - @ProtoFactory - BigDecimal create(Double value) { - return BigDecimal.valueOf(value); - } - - @ProtoField(number = 1, type = Type.DOUBLE, defaultValue = "0") - Double value(BigDecimal value) { - return value.doubleValue(); - } -} ----- - If your classes have only mutable fields, then the `ProtoFactory` annotation is not required, assuming your class has a no arg constructor. @@ -173,6 +156,10 @@ on it to specify configuration settings .BookContextInitializer.java [source,java] ---- +import org.infinispan.protostream.SerializationContextInitializer; +import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder; +import org.infinispan.protostream.types.java.math.BigDecimalAdapter; + @AutoProtoSchemaBuilder(includeClasses = { Book.class, Author.class, BigDecimalAdapter.class }, schemaPackageName = "book_sample") interface BookContextInitializer extends SerializationContextInitializer { } 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 39b0be96002ec..30fb5c4add76c 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 @@ -179,9 +179,6 @@ InfinispanPropertiesBuildItem setup(ApplicationArchivesBuildItem applicationArch // This is required for netty to work properly reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, "io.netty.channel.socket.nio.NioSocketChannel")); - nativeImageConfig.produce(NativeImageConfigBuildItem.builder() - .addRuntimeInitializedClass("org.infinispan.client.hotrod.impl.transport.netty.TransportHelper") - .build()); // We use reflection to have continuous queries work reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, "org.infinispan.client.hotrod.event.impl.ContinuousQueryImpl$ClientEntryListener")); diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteTransportHelper.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteDefaultTransportFactory.java similarity index 69% rename from extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteTransportHelper.java rename to extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteDefaultTransportFactory.java index 215960402114e..ae6484f95395b 100644 --- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteTransportHelper.java +++ b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteDefaultTransportFactory.java @@ -2,6 +2,8 @@ import java.util.concurrent.ExecutorService; +import org.infinispan.client.hotrod.impl.transport.netty.DefaultTransportFactory; + import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; @@ -15,17 +17,16 @@ * * @author William Burns */ -@Substitute -@TargetClass(className = "org.infinispan.client.hotrod.impl.transport.netty.TransportHelper") -final class SubstituteTransportHelper { +@TargetClass(DefaultTransportFactory.class) +final class SubstituteDefaultTransportFactory { @Substitute - static Class socketChannel() { + public Class socketChannelClass() { return NioSocketChannel.class; } @Substitute - static EventLoopGroup createEventLoopGroup(int maxExecutors, ExecutorService executorService) { + public EventLoopGroup createEventLoopGroup(int maxExecutors, ExecutorService executorService) { return new NioEventLoopGroup(maxExecutors, executorService); } } diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheImpl.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheImpl.java index ecec2b9261992..4c7cee6dad754 100644 --- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheImpl.java +++ b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheImpl.java @@ -5,7 +5,6 @@ import org.infinispan.client.hotrod.configuration.Configuration; import org.infinispan.client.hotrod.impl.RemoteCacheImpl; import org.infinispan.client.hotrod.impl.operations.OperationsFactory; -import org.infinispan.commons.marshall.Marshaller; import com.oracle.svm.core.annotate.Delete; import com.oracle.svm.core.annotate.Substitute; @@ -32,7 +31,6 @@ private void unregisterMBean() { // Sadly this method is public, so technically a user could get a Runtime error if they were referencing // it before - but it is the only way to make graal happy @Delete - public void init(Marshaller marshaller, OperationsFactory operationsFactory, - Configuration configuration, ObjectName jmxParent) { + public void init(OperationsFactory operationsFactory, Configuration configuration, ObjectName jmxParent) { } } diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheManager.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheManager.java index 26625d6656b9f..a08ecebb55cb8 100644 --- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheManager.java +++ b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/graal/SubstituteRemoteCacheManager.java @@ -25,7 +25,7 @@ public final class SubstituteRemoteCacheManager { @Substitute private void initRemoteCache(InternalRemoteCache remoteCache, OperationsFactory operationsFactory) { // Invoke the init method that doesn't have the JMX ObjectName argument - remoteCache.init(marshaller, operationsFactory, configuration); + remoteCache.init(operationsFactory, configuration); } @Substitute @@ -34,6 +34,9 @@ private void registerMBean() { @Substitute private void unregisterMBean() { + } + @Substitute + private void registerProtoStreamMarshaller() { } } diff --git a/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BigDecimalAdapter.java b/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BigDecimalAdapter.java deleted file mode 100644 index 8d4084c8871cc..0000000000000 --- a/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BigDecimalAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -package io.quarkus.it.infinispan.client; - -import java.math.BigDecimal; - -import org.infinispan.protostream.annotations.ProtoAdapter; -import org.infinispan.protostream.annotations.ProtoFactory; -import org.infinispan.protostream.annotations.ProtoField; -import org.infinispan.protostream.descriptors.Type; - -@ProtoAdapter(BigDecimal.class) -public class BigDecimalAdapter { - @ProtoFactory - BigDecimal create(Double value) { - return BigDecimal.valueOf(value); - } - - @ProtoField(number = 1, type = Type.DOUBLE, defaultValue = "0") - Double value(BigDecimal value) { - return value.doubleValue(); - } -} diff --git a/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BookContextInitializer.java b/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BookContextInitializer.java index dcb626ef21026..fcd355b225d73 100644 --- a/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BookContextInitializer.java +++ b/integration-tests/infinispan-client/src/main/java/io/quarkus/it/infinispan/client/BookContextInitializer.java @@ -2,6 +2,7 @@ import org.infinispan.protostream.SerializationContextInitializer; import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder; +import org.infinispan.protostream.types.java.math.BigDecimalAdapter; @AutoProtoSchemaBuilder(includeClasses = { Book.class, Type.class, Author.class, BigDecimalAdapter.class }, schemaPackageName = "book_sample")