New gRPC channel manager#1400
Draft
rcameronm wants to merge 7 commits into
Draft
Conversation
59f2b3a to
4ece198
Compare
c2bb678 to
66d2625
Compare
fbruton
requested changes
Jun 11, 2026
| } | ||
|
|
||
| public static ChannelManager ofSubClass( | ||
| Class<? extends ChannelManager> clz, String host, int port, Configurator configG, ChannelCredentials credentials) { |
Collaborator
There was a problem hiding this comment.
Attached is a patch to replace reflection with a factory design pattern. Any class subclass without the proper method signature will throw a compile error.
0001-replace-reflection-with-a-factory.patch
Collaborator
Author
There was a problem hiding this comment.
I've been using this reflection pattern for awhile. Should I make some new tickets to change them to this factory design pattern as well?
Collaborator
There was a problem hiding this comment.
I recommend it. It will improve maintainability.
972e795 to
3a1b340
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the gRPC connection management system by replacing the old connection pooling approach with a new
ChannelManagerabstraction. The main goal is to provide a more flexible and configurable way to manage gRPC channels, making it easier to customize channel behavior and support different channel management strategies. The most significant changes are outlined below.Core Refactor: Channel Management Abstraction
Introduced a new abstract base class
ChannelManagerinemissary.grpc.channel, which centralizes configuration and management of gRPCManagedChannelconnections. This class supports various channel options (keep-alive, load balancing, message sizes) and provides a factory method for instantiating subclasses via reflection. (src/main/java/emissary/grpc/channel/ChannelManager.java)Updated
GrpcRoutingPlaceto useChannelManagerinstead of the previousConnectionFactoryand pooling approach. Each target now has a dedicatedGrpcInvokerbacked by aChannelManager, improving configurability and resource management. (src/main/java/emissary/grpc/GrpcRoutingPlace.java) [1] [2] [3] [4] [5]Configuration and API Updates
Added support for specifying the channel manager class via the
GRPC_CHANNEL_MANAGER_CLASS_NAMEconfiguration key, defaulting toPooledChannelManager. This allows for easy swapping or customization of channel management strategies. (src/main/java/emissary/grpc/GrpcRoutingPlace.java) [1] [2]Updated JavaDoc and documentation references in both
GrpcConnectionPlaceandGrpcRoutingPlaceto point toChannelManagerfor channel configuration, replacing references to the deprecatedConnectionFactory. (src/main/java/emissary/grpc/GrpcConnectionPlace.java,src/main/java/emissary/grpc/GrpcRoutingPlace.java) [1] [2]Simplification and Cleanup
Removed all usage of Apache Commons Pool and the associated
ConnectionFactoryandPoolExceptionclasses fromGrpcRoutingPlace, simplifying the code and reducing dependencies. (src/main/java/emissary/grpc/GrpcRoutingPlace.java) [1] [2] [3] [4]Refactored internal lookup and invocation logic in
GrpcRoutingPlaceto use the newinvokerTableandgetInvoker()method, streamlining how gRPC calls are routed and executed. (src/main/java/emissary/grpc/GrpcRoutingPlace.java) [1] [2] [3]These changes collectively modernize the gRPC connection infrastructure, making it more modular, configurable, and easier to extend or maintain.