Skip to content

Commit 4d037dc

Browse files
committed
Update JavaDocs for grpc-client classes
1 parent d61af1a commit 4d037dc

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

spring-grpc-core/src/main/java/org/springframework/grpc/client/DefaultGrpcChannelFactory.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
import io.grpc.ManagedChannel;
3030
import io.grpc.ManagedChannelBuilder;
3131

32+
/**
33+
* Default implementation of {@link GrpcChannelFactory} for creating and managing gRPC channels
34+
* <p>
35+
* Implements {@link DisposableBean} to shut down channels when no longer needed
36+
*
37+
* @author David Syer
38+
* @author Chris Bono
39+
*/
3240
public class DefaultGrpcChannelFactory implements GrpcChannelFactory, DisposableBean {
3341

3442
private final Map<String, ManagedChannelBuilder<?>> builders = new ConcurrentHashMap<>();
@@ -71,6 +79,13 @@ public ManagedChannelBuilder<?> createChannel(String authority) {
7179

7280
}
7381

82+
/**
83+
* Creates a new {@link ManagedChannelBuilder} instance for the given target path and credentials
84+
*
85+
* @param path the target path for the channel
86+
* @param creds the credentials for the channel
87+
* @return a new {@link ManagedChannelBuilder} for the given path and credentials
88+
*/
7489
protected ManagedChannelBuilder<?> newChannel(String path, ChannelCredentials creds) {
7590
return Grpc.newChannelBuilder(path, creds);
7691
}
@@ -82,6 +97,9 @@ public void destroy() {
8297
}
8398
}
8499

100+
/**
101+
* A {@link ManagedChannelBuilder} wrapper that ensures the created channel is disposed of when no longer needed
102+
*/
85103
class DisposableChannelBuilder extends ForwardingChannelBuilder2<DisposableChannelBuilder> {
86104

87105
private final ManagedChannelBuilder<?> delegate;

spring-grpc-core/src/main/java/org/springframework/grpc/client/GrpcChannelConfigurer.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,22 @@
1818

1919
import io.grpc.ManagedChannelBuilder;
2020

21+
/**
22+
* A functional interface for configuring a {@link ManagedChannelBuilder} for a specific authority
23+
*
24+
* @see ManagedChannelBuilder
25+
* @author Dave Syer
26+
* @author Chris Bono
27+
*/
2128
@FunctionalInterface
2229
public interface GrpcChannelConfigurer {
2330

31+
/**
32+
* Configures the given {@link ManagedChannelBuilder} for the specified authority
33+
*
34+
* @param authority the target authority for the channel
35+
* @param builder the builder to configure
36+
*/
2437
void configure(String authority, ManagedChannelBuilder<?> builder);
2538

2639
}

spring-grpc-core/src/main/java/org/springframework/grpc/client/GrpcChannelFactory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,20 @@
1818

1919
import io.grpc.ManagedChannelBuilder;
2020

21+
/**
22+
* Factory interface for creating {@link ManagedChannelBuilder} instances for a given authority
23+
*
24+
* @see ManagedChannelBuilder
25+
* @author Dave Syer
26+
*/
2127
public interface GrpcChannelFactory {
2228

29+
/**
30+
* Creates a {@link ManagedChannelBuilder} for the given authority
31+
*
32+
* @param authority the target authority for the channel
33+
* @return a {@link ManagedChannelBuilder} configured for the given authority
34+
*/
2335
ManagedChannelBuilder<?> createChannel(String authority);
2436

2537
}

0 commit comments

Comments
 (0)