@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1771") public abstract class ForwardingLoadBalancerHelper extends LoadBalancer.Helper
| Constructor and Description |
|---|
ForwardingLoadBalancerHelper() |
| Modifier and Type | Method and Description |
|---|---|
ManagedChannel |
createOobChannel(EquivalentAddressGroup eag,
String authority)
Out-of-band channel for LoadBalancer’s own RPC needs, e.g., talking to an external
load-balancer service.
|
LoadBalancer.Subchannel |
createSubchannel(EquivalentAddressGroup addrs,
Attributes attrs)
Creates a Subchannel, which is a logical connection to the given group of addresses which are
considered equivalent.
|
LoadBalancer.Subchannel |
createSubchannel(List<EquivalentAddressGroup> addrs,
Attributes attrs)
Creates a Subchannel, which is a logical connection to the given group of addresses which are
considered equivalent.
|
protected abstract LoadBalancer.Helper |
delegate()
Returns the underlying helper.
|
String |
getAuthority()
Returns the authority string of the channel, which is derived from the DNS-style target name.
|
NameResolver.Factory |
getNameResolverFactory()
Returns the NameResolver of the channel.
|
void |
runSerialized(Runnable task)
Schedule a task to be run in the Channel Executor, which serializes the task with the
callback methods on the
LoadBalancer interface. |
String |
toString() |
void |
updateBalancingState(ConnectivityState newState,
LoadBalancer.SubchannelPicker newPicker)
Set a new state with a new picker to the channel.
|
void |
updateOobChannelAddresses(ManagedChannel channel,
EquivalentAddressGroup eag)
Updates the addresses used for connections in the
Channel. |
void |
updateSubchannelAddresses(LoadBalancer.Subchannel subchannel,
EquivalentAddressGroup addrs)
Replaces the existing addresses used with
subchannel. |
void |
updateSubchannelAddresses(LoadBalancer.Subchannel subchannel,
List<EquivalentAddressGroup> addrs)
Replaces the existing addresses used with
subchannel. |
protected abstract LoadBalancer.Helper delegate()
public LoadBalancer.Subchannel createSubchannel(EquivalentAddressGroup addrs, Attributes attrs)
LoadBalancer.Helperattrs are custom attributes associated with this
Subchannel, and can be accessed later through Subchannel.getAttributes().
The LoadBalancer is responsible for closing unused Subchannels, and closing all
Subchannels within LoadBalancer.shutdown().
The default implementation calls LoadBalancer.Helper.createSubchannel(List, Attributes).
Implementations should not override this method.
createSubchannel in class LoadBalancer.Helperpublic LoadBalancer.Subchannel createSubchannel(List<EquivalentAddressGroup> addrs, Attributes attrs)
LoadBalancer.Helperattrs are custom attributes associated with this
Subchannel, and can be accessed later through Subchannel.getAttributes().
The LoadBalancer is responsible for closing unused Subchannels, and closing all
Subchannels within LoadBalancer.shutdown().
createSubchannel in class LoadBalancer.Helperpublic void updateSubchannelAddresses(LoadBalancer.Subchannel subchannel, EquivalentAddressGroup addrs)
LoadBalancer.Helpersubchannel. This method is superior to
LoadBalancer.Helper.createSubchannel(io.grpc.EquivalentAddressGroup, io.grpc.Attributes) when the new and old addresses overlap, since the subchannel can
continue using an existing connection.
The default implementation calls LoadBalancer.Helper.updateSubchannelAddresses(
LoadBalancer.Subchannel, List). Implementations should not override this method.
updateSubchannelAddresses in class LoadBalancer.Helperpublic void updateSubchannelAddresses(LoadBalancer.Subchannel subchannel, List<EquivalentAddressGroup> addrs)
LoadBalancer.Helpersubchannel. This method is superior to
LoadBalancer.Helper.createSubchannel(io.grpc.EquivalentAddressGroup, io.grpc.Attributes) when the new and old addresses overlap, since the subchannel can
continue using an existing connection.updateSubchannelAddresses in class LoadBalancer.Helperpublic ManagedChannel createOobChannel(EquivalentAddressGroup eag, String authority)
LoadBalancer.HelperThe LoadBalancer is responsible for closing unused OOB channels, and closing all OOB
channels within LoadBalancer.shutdown().
createOobChannel in class LoadBalancer.Helperpublic void updateOobChannelAddresses(ManagedChannel channel, EquivalentAddressGroup eag)
LoadBalancer.HelperChannel. This is supperior to
LoadBalancer.Helper.createOobChannel(io.grpc.EquivalentAddressGroup, java.lang.String) when the old and new addresses overlap, since the channel can
continue using an existing connection.updateOobChannelAddresses in class LoadBalancer.Helperpublic void updateBalancingState(ConnectivityState newState, LoadBalancer.SubchannelPicker newPicker)
LoadBalancer.HelperWhen a new picker is provided via updateBalancingState(), the channel will apply
the picker on all buffered RPCs, by calling LoadBalancer.SubchannelPicker.pickSubchannel(
LoadBalancer.PickSubchannelArgs).
The channel will hold the picker and use it for all RPCs, until updateBalancingState() is called again and a new picker replaces the old one. If updateBalancingState() has never been called, the channel will buffer all RPCs until a
picker is provided.
The passed state will be the channel's new state. The SHUTDOWN state should not be passed and its behavior is undefined.
updateBalancingState in class LoadBalancer.Helperpublic void runSerialized(Runnable task)
LoadBalancer.HelperLoadBalancer interface.runSerialized in class LoadBalancer.Helperpublic NameResolver.Factory getNameResolverFactory()
LoadBalancer.HelpergetNameResolverFactory in class LoadBalancer.Helperpublic String getAuthority()
LoadBalancer.HelpergetAuthority in class LoadBalancer.Helper