From ab140aac5183dc3617be9cf664fa905d73ea8e59 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Mon, 20 Apr 2020 18:03:51 +1000 Subject: [PATCH] Change embedded Infinispan to use config injection --- .../deployment/InfinispanEmbeddedProcessor.java | 10 ---------- .../runtime/InfinispanEmbeddedProducer.java | 8 +++----- .../embedded/runtime/InfinispanRecorder.java | 13 ------------- 3 files changed, 3 insertions(+), 28 deletions(-) delete mode 100644 extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanRecorder.java diff --git a/extensions/infinispan-embedded/deployment/src/main/java/io/quarkus/infinispan/embedded/deployment/InfinispanEmbeddedProcessor.java b/extensions/infinispan-embedded/deployment/src/main/java/io/quarkus/infinispan/embedded/deployment/InfinispanEmbeddedProcessor.java index 349f98da30117..3fc645addaba9 100644 --- a/extensions/infinispan-embedded/deployment/src/main/java/io/quarkus/infinispan/embedded/deployment/InfinispanEmbeddedProcessor.java +++ b/extensions/infinispan-embedded/deployment/src/main/java/io/quarkus/infinispan/embedded/deployment/InfinispanEmbeddedProcessor.java @@ -39,8 +39,6 @@ import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.ApplicationIndexBuildItem; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; @@ -49,8 +47,6 @@ import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.infinispan.embedded.runtime.InfinispanEmbeddedProducer; -import io.quarkus.infinispan.embedded.runtime.InfinispanEmbeddedRuntimeConfig; -import io.quarkus.infinispan.embedded.runtime.InfinispanRecorder; class InfinispanEmbeddedProcessor { @BuildStep @@ -203,10 +199,4 @@ private void addReflectionForName(String className, boolean isInterface, IndexVi classInfos.stream().map(ClassInfo::toString).toArray(String[]::new))); } } - - @Record(ExecutionTime.RUNTIME_INIT) - @BuildStep - void configureRuntimeProperties(InfinispanRecorder recorder, InfinispanEmbeddedRuntimeConfig runtimeConfig) { - recorder.configureRuntimeProperties(runtimeConfig); - } } diff --git a/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanEmbeddedProducer.java b/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanEmbeddedProducer.java index 0b9949a12de64..2eae14e2bf32d 100644 --- a/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanEmbeddedProducer.java +++ b/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanEmbeddedProducer.java @@ -6,6 +6,7 @@ import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; +import javax.inject.Inject; import javax.inject.Singleton; import org.infinispan.commons.CacheConfigurationException; @@ -25,11 +26,8 @@ @ApplicationScoped public class InfinispanEmbeddedProducer { - private volatile InfinispanEmbeddedRuntimeConfig config; - - public void setRuntimeConfig(InfinispanEmbeddedRuntimeConfig config) { - this.config = config; - } + @Inject + InfinispanEmbeddedRuntimeConfig config; @Singleton @Produces diff --git a/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanRecorder.java b/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanRecorder.java deleted file mode 100644 index 78e8facc1bb70..0000000000000 --- a/extensions/infinispan-embedded/runtime/src/main/java/io/quarkus/infinispan/embedded/runtime/InfinispanRecorder.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.quarkus.infinispan.embedded.runtime; - -import io.quarkus.arc.Arc; -import io.quarkus.runtime.annotations.Recorder; - -@Recorder -public class InfinispanRecorder { - - public void configureRuntimeProperties(InfinispanEmbeddedRuntimeConfig infinispanEmbeddedRuntimeConfig) { - InfinispanEmbeddedProducer iep = Arc.container().instance(InfinispanEmbeddedProducer.class).get(); - iep.setRuntimeConfig(infinispanEmbeddedRuntimeConfig); - } -} \ No newline at end of file