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) class
OutlierDetectionLoadBalancer.OutlierDetectionSubchannel.OutlierDetectionSubchannelStateListener
Wraps the actual listener so that state changes from the actual one can be intercepted.
-
Field Summary
Fields Modifier and Type Field Description private LoadBalancer.Subchannel
delegate
private boolean
ejected
private OutlierDetectionLoadBalancer.EndpointTracker
endpointTracker
private ConnectivityStateInfo
lastSubchannelState
private ChannelLogger
logger
private LoadBalancer.SubchannelStateListener
subchannelStateListener
-
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) void
clearEndpointTracker()
protected LoadBalancer.Subchannel
delegate()
Returns the underlying Subchannel.(package private) void
eject()
Attributes
getAttributes()
The same attributes passed toHelper.createSubchannel()
.(package private) boolean
isEjected()
(package private) void
setEndpointTracker(OutlierDetectionLoadBalancer.EndpointTracker endpointTracker)
If theLoadBalancer.Subchannel
is considered for outlier detection the associatedOutlierDetectionLoadBalancer.EndpointTracker
should be set.void
shutdown()
Shuts down the Subchannel.void
start(LoadBalancer.SubchannelStateListener listener)
Starts the Subchannel.java.lang.String
toString()
(package private) void
uneject()
void
updateAddresses(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.Subchannel
Starts 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:
start
in classForwardingSubchannel
- Parameters:
listener
- receives state updates for this Subchannel.
-
shutdown
public void shutdown()
Description copied from class:LoadBalancer.Subchannel
Shuts 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:
shutdown
in classForwardingSubchannel
-
getAttributes
public Attributes getAttributes()
Description copied from class:LoadBalancer.Subchannel
The same attributes passed toHelper.createSubchannel()
. LoadBalancer can use it to attach additional information here, e.g., the shard this Subchannel belongs to.- Overrides:
getAttributes
in classForwardingSubchannel
-
updateAddresses
public void updateAddresses(java.util.List<EquivalentAddressGroup> addressGroups)
Description copied from class:LoadBalancer.Subchannel
Replaces 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:
updateAddresses
in classForwardingSubchannel
-
setEndpointTracker
void setEndpointTracker(OutlierDetectionLoadBalancer.EndpointTracker endpointTracker)
If theLoadBalancer.Subchannel
is considered for outlier detection the associatedOutlierDetectionLoadBalancer.EndpointTracker
should be set.
-
clearEndpointTracker
void clearEndpointTracker()
-
eject
void eject()
-
uneject
void uneject()
-
isEjected
boolean isEjected()
-
delegate
protected LoadBalancer.Subchannel delegate()
Description copied from class:ForwardingSubchannel
Returns the underlying Subchannel.- Specified by:
delegate
in classForwardingSubchannel
-
toString
public java.lang.String toString()
- Overrides:
toString
in classForwardingSubchannel
-
-