Package io.grpc.util
Class OutlierDetectionLoadBalancer.OutlierDetectionSubchannel
- java.lang.Object
-
- io.grpc.LoadBalancer.Subchannel
-
- io.grpc.util.ForwardingSubchannel
-
- io.grpc.util.OutlierDetectionLoadBalancer.OutlierDetectionSubchannel
-
- Enclosing class:
- OutlierDetectionLoadBalancer
class OutlierDetectionLoadBalancer.OutlierDetectionSubchannel extends ForwardingSubchannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classOutlierDetectionLoadBalancer.OutlierDetectionSubchannel.OutlierDetectionSubchannelStateListenerWraps the actual listener so that state changes from the actual one can be intercepted.
-
Field Summary
Fields Modifier and Type Field Description private LoadBalancer.Subchanneldelegateprivate booleanejectedprivate OutlierDetectionLoadBalancer.EndpointTrackerendpointTrackerprivate ConnectivityStateInfolastSubchannelStateprivate ChannelLoggerloggerprivate LoadBalancer.SubchannelStateListenersubchannelStateListener
-
Constructor Summary
Constructors Constructor Description OutlierDetectionSubchannel(LoadBalancer.CreateSubchannelArgs args, LoadBalancer.Helper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclearEndpointTracker()protected LoadBalancer.Subchanneldelegate()Returns the underlying Subchannel.(package private) voideject()AttributesgetAttributes()The same attributes passed toHelper.createSubchannel().(package private) booleanisEjected()(package private) voidsetEndpointTracker(OutlierDetectionLoadBalancer.EndpointTracker endpointTracker)If theLoadBalancer.Subchannelis considered for outlier detection the associatedOutlierDetectionLoadBalancer.EndpointTrackershould be set.voidshutdown()Shuts down the Subchannel.voidstart(LoadBalancer.SubchannelStateListener listener)Starts the Subchannel.java.lang.StringtoString()(package private) voiduneject()voidupdateAddresses(java.util.List<EquivalentAddressGroup> addressGroups)Replaces the existing addresses used with thisSubchannel.-
Methods inherited from class io.grpc.util.ForwardingSubchannel
asChannel, getAllAddresses, getChannelLogger, getConnectedAddressAttributes, getInternalSubchannel, requestConnection
-
Methods inherited from class io.grpc.LoadBalancer.Subchannel
getAddresses
-
-
-
-
Field Detail
-
delegate
private final LoadBalancer.Subchannel delegate
-
endpointTracker
private OutlierDetectionLoadBalancer.EndpointTracker endpointTracker
-
ejected
private boolean ejected
-
lastSubchannelState
private ConnectivityStateInfo lastSubchannelState
-
subchannelStateListener
private LoadBalancer.SubchannelStateListener subchannelStateListener
-
logger
private final ChannelLogger logger
-
-
Constructor Detail
-
OutlierDetectionSubchannel
OutlierDetectionSubchannel(LoadBalancer.CreateSubchannelArgs args, LoadBalancer.Helper helper)
-
-
Method Detail
-
start
public void start(LoadBalancer.SubchannelStateListener listener)
Description copied from class:LoadBalancer.SubchannelStarts the Subchannel. Can only be called once.Must be called prior to any other method on this class, except for
LoadBalancer.Subchannel.shutdown()which may be called at any time.Must be called from the
Synchronization Context, otherwise it may throw. See #5015 for more discussions.- Overrides:
startin classForwardingSubchannel- Parameters:
listener- receives state updates for this Subchannel.
-
shutdown
public void shutdown()
Description copied from class:LoadBalancer.SubchannelShuts down the Subchannel. After this method is called, this Subchannel should no longer be returned by the latestpicker, and can be safely discarded.Calling it on an already shut-down Subchannel has no effect.
It should be called from the Synchronization Context. Currently will log a warning if violated. It will become an exception eventually. See #5015 for the background.
- Overrides:
shutdownin classForwardingSubchannel
-
getAttributes
public Attributes getAttributes()
Description copied from class:LoadBalancer.SubchannelThe same attributes passed toHelper.createSubchannel(). LoadBalancer can use it to attach additional information here, e.g., the shard this Subchannel belongs to.- Overrides:
getAttributesin classForwardingSubchannel
-
updateAddresses
public void updateAddresses(java.util.List<EquivalentAddressGroup> addressGroups)
Description copied from class:LoadBalancer.SubchannelReplaces the existing addresses used with thisSubchannel. If the new and old addresses overlap, the Subchannel can continue using an existing connection.It must be called from the Synchronization Context or will throw.
- Overrides:
updateAddressesin classForwardingSubchannel
-
setEndpointTracker
void setEndpointTracker(OutlierDetectionLoadBalancer.EndpointTracker endpointTracker)
If theLoadBalancer.Subchannelis considered for outlier detection the associatedOutlierDetectionLoadBalancer.EndpointTrackershould be set.
-
clearEndpointTracker
void clearEndpointTracker()
-
eject
void eject()
-
uneject
void uneject()
-
isEjected
boolean isEjected()
-
delegate
protected LoadBalancer.Subchannel delegate()
Description copied from class:ForwardingSubchannelReturns the underlying Subchannel.- Specified by:
delegatein classForwardingSubchannel
-
toString
public java.lang.String toString()
- Overrides:
toStringin classForwardingSubchannel
-
-