Skip to content

Commit 444b1ad

Browse files
committed
Initial client review
1 parent f3a8de1 commit 444b1ad

10 files changed

+35
-0
lines changed

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/ChannelBuilderCustomizers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
*/
3535
public class ChannelBuilderCustomizers {
3636

37+
// FIXME PW: Make package private?
38+
3739
private final List<GrpcChannelBuilderCustomizer<?>> customizers;
3840

3941
ChannelBuilderCustomizers(List<? extends GrpcChannelBuilderCustomizer<?>> customizers) {

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/ClientInterceptorsConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
@Configuration(proxyBeanMethods = false)
3232
public class ClientInterceptorsConfiguration {
3333

34+
// FIXME PW: Make package private?
35+
3436
@Bean
3537
@ConditionalOnMissingBean
3638
ClientInterceptorsConfigurer clientInterceptorsConfigurer(ApplicationContext applicationContext) {

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/ClientScanConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
@Import(DefaultGrpcClientRegistrations.class)
4545
public class ClientScanConfiguration {
4646

47+
// FIXME PW: Package private?
48+
49+
// FIXME PW: Why inner class? AbstractGrpcClientRegistrar protection perhaps?
50+
// FIXME PW: Swith from Import to Bean method?
4751
static class DefaultGrpcClientRegistrations extends AbstractGrpcClientRegistrar
4852
implements EnvironmentAware, BeanFactoryAware {
4953

@@ -66,6 +70,7 @@ protected GrpcClientRegistrationSpec[] collect(AnnotationMetadata meta) {
6670
Assert.notNull(this.environment, "Environment must not be null");
6771
Assert.notNull(this.beanFactory, "BeanFactory must not be null");
6872
Binder binder = Binder.get(this.environment);
73+
// FIXME PW: Why direct binding and not properties injection?
6974
boolean hasDefaultChannel = binder.bind("spring.grpc.client.default-channel", ChannelConfig.class)
7075
.isBound();
7176
if (hasDefaultChannel) {

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/ConditionalOnGrpcClientEnabled.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@
4242
@ConditionalOnProperty(prefix = "spring.grpc.client", name = "enabled", matchIfMissing = true)
4343
public @interface ConditionalOnGrpcClientEnabled {
4444

45+
// FIXME PW: package private?
46+
4547
}

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/GrpcChannelFactoryConfigurations.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ShadedNettyGrpcChannelFactory shadedNettyGrpcChannelFactory(GrpcClientProperties
6262
ChannelCredentialsProvider credentials) {
6363
List<GrpcChannelBuilderCustomizer<io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder>> builderCustomizers = List
6464
.of(channelBuilderCustomizers::customize);
65+
// FIXME PW: sweep for
6566
var factory = new ShadedNettyGrpcChannelFactory(builderCustomizers, interceptorsConfigurer);
6667
factory.setCredentialsProvider(credentials);
6768
factory.setVirtualTargets(properties);

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/GrpcChannelFactoryCustomizer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
public interface GrpcChannelFactoryCustomizer {
2222

23+
// FIXME PW: Doc comment
24+
// FIXME PW: Function interface?
25+
2326
/**
2427
* Customize the given {@link GrpcChannelFactory}.
2528
* @param factory the factory to customize

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/GrpcClientObservationAutoConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
public final class GrpcClientObservationAutoConfiguration {
3838

39+
// FIXME PW: Should grpc know about observation or should we flip it?
40+
3941
@Bean
4042
@GlobalClientInterceptor
4143
@ConditionalOnMissingBean

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/GrpcClientProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
@ConfigurationProperties(prefix = "spring.grpc.client")
4040
public class GrpcClientProperties implements EnvironmentAware, VirtualTargets {
4141

42+
// FIXME PW: Properties should be anemic. No implemented EnvironmentAware or
43+
// VirtualTargets
44+
4245
/**
4346
* The default channel configuration to use for new channels.
4447
*/
@@ -54,6 +57,8 @@ public class GrpcClientProperties implements EnvironmentAware, VirtualTargets {
5457
*/
5558
private Class<? extends StubFactory<?>> defaultStubFactory = BlockingStubFactory.class;
5659

60+
// FIXME PW: Unusual to have class names in properties. Should we do this another way?
61+
5762
private Environment environment;
5863

5964
GrpcClientProperties() {
@@ -90,13 +95,16 @@ public void setEnvironment(Environment environment) {
9095
* default channel as a template
9196
*/
9297
public ChannelConfig getChannel(String name) {
98+
// FIXME PW: Unusual logic for properties class
99+
// FIXME PW: Check callers of this method. What's name mean?
93100
if ("default".equals(name)) {
94101
return this.defaultChannel;
95102
}
96103
ChannelConfig channel = this.channels.get(name);
97104
if (channel != null) {
98105
return channel;
99106
}
107+
// FIXME PW: Looks like convention. Move somewhere else?
100108
channel = this.defaultChannel.copy();
101109
String address = name;
102110
if (!name.contains(":/") && !name.startsWith("unix:")) {
@@ -134,6 +142,8 @@ public static class ChannelConfig {
134142
*/
135143
private String address = "static://localhost:9090";
136144

145+
// FIXME PW: All privates at top then getter / setters
146+
137147
public String getAddress() {
138148
return this.address;
139149
}
@@ -351,6 +361,7 @@ public void setDefaultDeadline(@Nullable Duration defaultDeadline) {
351361
* @return a copy of the channel instance.
352362
*/
353363
public ChannelConfig copy() {
364+
// FIXME PW: What's this for? Pretty unusual in a properties class
354365
ChannelConfig copy = new ChannelConfig();
355366
copy.address = this.address;
356367
copy.defaultLoadBalancingPolicy = this.defaultLoadBalancingPolicy;
@@ -407,6 +418,7 @@ public static class Ssl {
407418
*/
408419
private @Nullable String bundle;
409420

421+
// FIXME PW: Anemic getters / getter
410422
public boolean isEnabled() {
411423
return (this.enabled != null) ? this.enabled : this.bundle != null;
412424
}
@@ -434,6 +446,8 @@ public void copyValuesFrom(Ssl other) {
434446

435447
}
436448

449+
// FIXME PW: Review how heath works.
450+
437451
public static class Health {
438452

439453
/**

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/NamedChannelCredentialsProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
*/
3939
public class NamedChannelCredentialsProvider implements ChannelCredentialsProvider {
4040

41+
// FIXME PW: Package private?
42+
4143
private final SslBundles bundles;
4244

4345
private final GrpcClientProperties properties;

module/spring-boot-grpc-client/src/main/java/org/springframework/boot/grpc/client/autoconfigure/codec/GrpcCodecConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class GrpcCodecConfiguration {
4141
@Bean
4242
@ConditionalOnMissingBean
4343
CompressorRegistry compressorRegistry(ObjectProvider<Compressor> compressors) {
44+
// FIXME PW: @ExperimentalApi ??
45+
// FIXME PW: getDefaultInstance() is a static. Is that what we want?
4446
CompressorRegistry registry = CompressorRegistry.getDefaultInstance();
4547
compressors.orderedStream().forEachOrdered(registry::register);
4648
return registry;

0 commit comments

Comments
 (0)