Package io.grpc.grpclb
Interface SubchannelPool
- All Known Implementing Classes:
CachedSubchannelPool
@NotThreadSafe
interface SubchannelPool
Manages life-cycle of Subchannels for
GrpclbState
.
All methods are run from the ChannelExecutor that the helper uses.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Receives state changes for a pooledLoadBalancer.Subchannel
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Shuts down all subchannels in the pool immediately.void
Registers a listener to received Subchannel status updates.void
returnSubchannel
(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo lastKnownState) Puts aLoadBalancer.Subchannel
back to the pool.takeOrCreateSubchannel
(EquivalentAddressGroup eag, Attributes defaultAttributes) Takes aLoadBalancer.Subchannel
from the pool for the giveneag
if there is one available.
-
Method Details
-
registerListener
Registers a listener to received Subchannel status updates. -
takeOrCreateSubchannel
LoadBalancer.Subchannel takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes) Takes aLoadBalancer.Subchannel
from the pool for the giveneag
if there is one available. Otherwise, creates and returns a newSubchannel
with the giveneag
anddefaultAttributes
. -
returnSubchannel
Puts aLoadBalancer.Subchannel
back to the pool. From this point the Subchannel is owned by the pool, and the caller should stop referencing to this Subchannel. -
clear
void clear()Shuts down all subchannels in the pool immediately.
-