From 42daa54d33886f53cd85f7dee9086c95750bf10c Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Wed, 29 Mar 2023 12:22:56 -0500 Subject: [PATCH] Follow up on shaded cache modules (#388) * Add new module descriptions to README.adoc * Replace non-shaded Caffeine classes w/ shaded version in PulsarRuntimeHints.java --- README.adoc | 21 ++++++++++++------- .../pulsar/aot/PulsarRuntimeHints.java | 17 +++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.adoc b/README.adoc index 33e7fd5c..8e262683 100644 --- a/README.adoc +++ b/README.adoc @@ -70,8 +70,11 @@ There are several modules in Spring Pulsar. Here is a quick overview: === spring-pulsar The main library that provides the API to access Apache Pulsar. -=== spring-pulsar-reactive -Provides the API to access Apache Pulsar using a Reactive client. +=== spring-pulsar-cache-provider +Provides the interfaces for the cache provider used by the main library to cache producers. + +=== spring-pulsar-cache-provider-caffeine +Provides the implementation of the cache provider using a shaded version of Caffeine. === spring-pulsar-dependencies Provides a Gradle https://docs.gradle.org/current/userguide/java_platform_plugin.html[java-platform] that recommends dependency versions. @@ -79,20 +82,24 @@ Provides a Gradle https://docs.gradle.org/current/userguide/java_platform_plugin === spring-pulsar-docs Provides reference docs and handles aggregating javadocs. +=== spring-pulsar-reactive +Provides the API to access Apache Pulsar using a Reactive client. + +=== spring-pulsar-reactive-spring-boot-starter +Provides a dependency descriptor that can be included in your application to easily start using Spring Pulsar in Reactive and imperative fashions. + +=== spring-pulsar-sample-apps +Provides sample applications to illustrate Spring Pulsar functionality as well as provide ability for quick manual verification during development. + === spring-pulsar-spring-boot-autoconfigure Provides Spring Boot auto-configuration for Spring Pulsar. === spring-pulsar-spring-boot-starter Provides a dependency descriptor that can be included in your application to easily start using Spring Pulsar in an imperative fashion. -=== spring-pulsar-reactive-spring-boot-starter -Provides a dependency descriptor that can be included in your application to easily start using Spring Pulsar in Reactive and imperative fashions. - === spring-pulsar-spring-cloud-stream-binder Provides a Spring Cloud Stream Binder implementation for Apache Pulsar. -=== spring-pulsar-sample-apps -Provides sample applications to illustrate Spring Pulsar functionality as well as provide ability for quick manual verification during development. == License Spring Pulsar is Open Source software released under the https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 license]. diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/aot/PulsarRuntimeHints.java b/spring-pulsar/src/main/java/org/springframework/pulsar/aot/PulsarRuntimeHints.java index c0984798..340fecc6 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/aot/PulsarRuntimeHints.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/aot/PulsarRuntimeHints.java @@ -51,10 +51,9 @@ public class PulsarRuntimeHints implements RuntimeHintsRegistrar { public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { ReflectionHints reflectionHints = hints.reflection(); // The following components need access to declared constructors, invoke declared - // methods - // and introspect all public methods. The components are a mix of JDK classes, - // core Pulsar classes, - // some other shaded components available through Pulsar client. + // methods and introspect all public methods. The components are a mix of JDK + // classes, core Pulsar classes, and some other shaded components available + // through Pulsar client. Stream.of(HashSet.class, LinkedHashMap.class, TreeMap.class, Authentication.class, AuthenticationDataProvider.class, SecretsSerializer.class, PulsarAdminBuilderImpl.class, OffloadProcessStatusImpl.class, Commands.class).forEach( @@ -72,12 +71,10 @@ public class PulsarRuntimeHints implements RuntimeHintsRegistrar { MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INTROSPECT_PUBLIC_METHODS, MemberCategory.DECLARED_CLASSES, MemberCategory.DECLARED_FIELDS))); + // @formatter:off // These are shaded classes and other inaccessible interfaces/classes (thus using // string version of API). - // @formatter:off - Stream.of("com.github.benmanes.caffeine.cache.SSMSA", - "com.github.benmanes.caffeine.cache.PSAMS", - "org.apache.pulsar.client.admin.internal.JacksonConfigurator", + Stream.of("org.apache.pulsar.client.admin.internal.JacksonConfigurator", "org.apache.pulsar.client.impl.conf.TopicConsumerConfigurationData", "org.apache.pulsar.client.impl.conf.TopicConsumerConfigurationData$TopicNameMatcher", "org.apache.pulsar.client.util.SecretsSerializer", @@ -219,7 +216,9 @@ public class PulsarRuntimeHints implements RuntimeHintsRegistrar { "org.apache.pulsar.shade.org.jvnet.hk2.internal.DynamicConfigurationServiceImpl", "org.apache.pulsar.shade.org.jvnet.hk2.internal.DynamicConfigurationServiceImpl", "org.apache.pulsar.shade.org.jvnet.hk2.internal.ServiceLocatorRuntimeImpl", - "org.apache.pulsar.shade.org.jvnet.hk2.internal.ServiceLocatorRuntimeImpl") + "org.apache.pulsar.shade.org.jvnet.hk2.internal.ServiceLocatorRuntimeImpl", + "org.springframework.pulsar.shade.com.github.benmanes.caffeine.cache.SSMSA", + "org.springframework.pulsar.shade.com.github.benmanes.caffeine.cache.PSAMS") .forEach(type -> reflectionHints.registerTypeIfPresent(classLoader, type, builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,