Package io.grpc.grpclb
Interface SubchannelPool
-
- All Known Implementing Classes:
CachedSubchannelPool
@NotThreadSafe interface SubchannelPool
Manages 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 interface
SubchannelPool.PooledSubchannelStateListener
Receives state changes for a pooledLoadBalancer.Subchannel
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Shuts down all subchannels in the pool immediately.void
registerListener(SubchannelPool.PooledSubchannelStateListener listener)
Registers a listener to received Subchannel status updates.void
returnSubchannel(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo lastKnownState)
Puts aLoadBalancer.Subchannel
back to the pool.LoadBalancer.Subchannel
takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes)
Takes aLoadBalancer.Subchannel
from the pool for the giveneag
if 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.Subchannel
from the pool for the giveneag
if there is one available. Otherwise, creates and returns a newSubchannel
with the giveneag
anddefaultAttributes
.
-
returnSubchannel
void returnSubchannel(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo lastKnownState)
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.
-
-