You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we are doing lot of wrapping on the LoadBalancer API, and Subchannels are passed through various interfaces, a wrapped Subchannel will require a lot of care to make sure it's consistent on all APIs, e.g.,
The Subchannel from createSubchannel() should be the same objects that's passed to SubchannelStateListener on every wrapping level.
The Subchannel from PickResult will have to be unwrapped as well. ManagedChannelImpl assumes the Subchannel from PickResult is the real "SubchannelImpl".
Possible solutions:
Move LoadBalancer.Helper methods that accepts Subchannel to the Subchannel class, e.g., updateSubchannelAddresses(). Stop passing Subchannel to the listeners. But that requires a start(), which is a non-trivial API change on the current Subchannel, but could be considered for new APIs.
The opposite of above -- move all state-mutating methods, e.g., shutdown(), requestConnection() to Helper, eliminating the need for wrapping Subchannel.
Provide a util to help correctly wrap Subchannel while keeping the consistency.
Add another identity object to Subchannel. This could also used by ManagedChannelImpl to retrieve the real "SubchannelImpl" from PickResult.
Solutions 2 and 5 wouldn't go along with our plan of changing Subchannel attributes to an object, because a wrapping Helper can only add its own stuff on that object by wrapping it, which ends up the need for unwrapping it on the Subchannel. Otherwise they seem to work well.
Since we are doing lot of wrapping on the LoadBalancer API, and Subchannels are passed through various interfaces, a wrapped Subchannel will require a lot of care to make sure it's consistent on all APIs, e.g.,
createSubchannel()should be the same objects that's passed toSubchannelStateListeneron every wrapping level.SubchannelfromPickResultwill have to be unwrapped as well.ManagedChannelImplassumes theSubchannelfromPickResultis the real "SubchannelImpl".Possible solutions:
LoadBalancer.Helpermethods that acceptsSubchannelto theSubchannelclass, e.g.,updateSubchannelAddresses(). Stop passingSubchannelto the listeners. But that requires astart(), which is a non-trivial API change on the currentSubchannel, but could be considered for new APIs.shutdown(),requestConnection()toHelper, eliminating the need for wrappingSubchannel.Subchannelwhile keeping the consistency.Subchannel. This could also used byManagedChannelImplto retrieve the real "SubchannelImpl" fromPickResult.Solutions 2 and 5 wouldn't go along with our plan of changing Subchannel attributes to an object, because a wrapping Helper can only add its own stuff on that object by wrapping it, which ends up the need for unwrapping it on the Subchannel. Otherwise they seem to work well.
@ejona86 @voidzcy