40
40
import org .springframework .aot .hint .RuntimeHintsRegistrar ;
41
41
import org .springframework .aot .hint .TypeReference ;
42
42
import org .springframework .lang .Nullable ;
43
+ import org .springframework .util .ReflectionUtils ;
43
44
44
45
/**
45
- * {@link RuntimeHintsRegistrar} for Spring for Apache Pulsar.
46
+ * {@link RuntimeHintsRegistrar} for Spring for Apache Pulsar (reactive) .
46
47
*
47
48
* @author Soby Chacko
49
+ * @author Chris Bono
48
50
*/
49
51
public class ReactivePulsarRuntimeHints implements RuntimeHintsRegistrar {
50
52
@@ -74,8 +76,7 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
74
76
MemberCategory .DECLARED_CLASSES , MemberCategory .DECLARED_FIELDS )));
75
77
76
78
// These are inaccessible interfaces/classes in a normal scenario, thus using the
77
- // String version,
78
- // and we need field level access in them.
79
+ // String version, and we need field level access in them.
79
80
Stream .of (
80
81
"org.apache.pulsar.shade.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields" ,
81
82
"org.apache.pulsar.shade.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields" ,
@@ -86,13 +87,72 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
86
87
.forEach (typeName -> reflectionHints .registerTypeIfPresent (classLoader , typeName ,
87
88
MemberCategory .DECLARED_FIELDS ));
88
89
89
- Stream
90
- .of ("reactor.core.publisher.Flux" , "com.github.benmanes.caffeine.cache.SSMSA" ,
91
- "com.github.benmanes.caffeine.cache.PSAMS" , "com.github.benmanes.caffeine.cache.SSLMSA" ,
92
- "com.github.benmanes.caffeine.cache.PSAMW" )
93
- .forEach (typeName -> reflectionHints .registerTypeIfPresent (classLoader , typeName ,
94
- MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_DECLARED_METHODS ,
95
- MemberCategory .INTROSPECT_PUBLIC_METHODS ));
90
+ // @formatter:off
91
+ Stream .of (
92
+ "reactor.core.publisher.Flux" ,
93
+ "java.lang.Thread" ,
94
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef" ,
95
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BBHeader$ReadCounterRef" ,
96
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BLCHeader" ,
97
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef" ,
98
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BLCHeader$PadDrainStatus" ,
99
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueColdProducerFields" ,
100
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueConsumerFields" ,
101
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueProducerFields" ,
102
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.BoundedLocalCache" ,
103
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.CacheLoader" ,
104
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.FS" ,
105
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.FW" ,
106
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PD" ,
107
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PS" ,
108
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSA" ,
109
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSAMS" ,
110
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSAW" ,
111
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSAWMW" ,
112
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSMS" ,
113
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSMW" ,
114
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSR" ,
115
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSRMS" ,
116
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSW" ,
117
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSWMS" ,
118
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PSWMW" ,
119
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.PW" ,
120
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SI" ,
121
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SS" ,
122
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSA" ,
123
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSAW" ,
124
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSL" ,
125
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSLAW" ,
126
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSLMS" ,
127
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSLMSA" ,
128
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSLMSAW" ,
129
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSLSW" ,
130
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSLW" ,
131
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSMS" ,
132
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSMSA" ,
133
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSMSAW" ,
134
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSMSR" ,
135
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSMSW" ,
136
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSMW" ,
137
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSSMS" ,
138
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSSMWW" ,
139
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSSW" ,
140
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.SSW" ,
141
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.StripedBuffer" ,
142
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.UnboundedLocalCache" ,
143
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.WI" ,
144
+ "org.apache.pulsar.reactive.shade.com.github.benmanes.caffeine.cache.WS" )
145
+ .forEach (type -> reflectionHints .registerTypeIfPresent (classLoader , type ,
146
+ builder -> builder .withMembers (
147
+ MemberCategory .INVOKE_DECLARED_CONSTRUCTORS ,
148
+ MemberCategory .INVOKE_PUBLIC_METHODS ,
149
+ MemberCategory .INVOKE_DECLARED_METHODS ,
150
+ MemberCategory .INTROSPECT_PUBLIC_METHODS ,
151
+ MemberCategory .DECLARED_CLASSES ,
152
+ MemberCategory .DECLARED_FIELDS )));
153
+ reflectionHints .registerField (ReflectionUtils .findField (Thread .class , "threadLocalRandomProbe" ));
154
+
155
+ // @formatter:on
96
156
97
157
// Registering JDK dynamic proxies for these interfaces. Since the Connection
98
158
// interface is protected,
0 commit comments