Package io.grpc.grpclb
Interface SubchannelPool
-
- All Known Implementing Classes:
CachedSubchannelPool
@NotThreadSafe interface SubchannelPoolManages life-cycle of Subchannels forGrpclbState.All methods are run from the ChannelExecutor that the helper uses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSubchannelPool.PooledSubchannelStateListenerReceives state changes for a pooledLoadBalancer.Subchannel.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Shuts down all subchannels in the pool immediately.voidregisterListener(SubchannelPool.PooledSubchannelStateListener listener)Registers a listener to received Subchannel status updates.voidreturnSubchannel(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo lastKnownState)Puts aLoadBalancer.Subchannelback to the pool.LoadBalancer.SubchanneltakeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes)Takes aLoadBalancer.Subchannelfrom the pool for the giveneagif there is one available.
-
-
-
Method Detail
-
registerListener
void registerListener(SubchannelPool.PooledSubchannelStateListener listener)
Registers a listener to received Subchannel status updates.
-
takeOrCreateSubchannel
LoadBalancer.Subchannel takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes)
Takes aLoadBalancer.Subchannelfrom the pool for the giveneagif there is one available. Otherwise, creates and returns a newSubchannelwith the giveneaganddefaultAttributes.
-
returnSubchannel
void returnSubchannel(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo lastKnownState)
Puts aLoadBalancer.Subchannelback 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.
-
-