Skip to content

Commit 9c5db01

Browse files
committed
api: Deprecate the old way of handling resolved addresses in LoadBalancer
1 parent 18e274d commit 9c5db01

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

api/src/main/java/io/grpc/LoadBalancer.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ public abstract class LoadBalancer {
126126
*
127127
* @param resolvedAddresses the resolved server addresses, attributes, and config.
128128
* @since 1.21.0
129+
* @deprecated Please override {@code acceptResolvedAddresses()} instead. Also note that
130+
* {@code canHandleEmptyAddressListFromNameResolution()} is deprecated as well as
131+
* {@code acceptResolvedAddresses()} should now indicate the acceptance of the addresses with
132+
* its return value.
129133
*/
134+
@Deprecated
130135
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
131136
if (recursionCount++ == 0) {
132137
// Note that the information about the addresses actually being accepted will be lost
@@ -141,7 +146,9 @@ public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
141146
* EquivalentAddressGroup} addresses should be considered equivalent but may be flattened into a
142147
* single list if needed.
143148
*
144-
* <p>Implementations can choose to reject the given addresses by returning {@code false}.
149+
* <p>Implementations can choose to reject the given addresses by returning {@code false}. Please
150+
* note that an empty list of addresses could be provided and that the deprecated {@code
151+
* canHandleEmptyAddressListFromNameResolution()} will be ignored when this method is overwritten.
145152
*
146153
* <p>Implementations should not modify the given {@code addresses}.
147154
*
@@ -379,7 +386,16 @@ public void handleSubchannelState(
379386
*
380387
* <p>This method should always return a constant value. It's not specified when this will be
381388
* called.
389+
*
390+
* <p>Note that this method is only called when the deprecated {@code handleResolvedAddresses()}
391+
* is overwritten.
392+
*
393+
* @deprecated Instead of overwriting this and {@code handleResolvedAddresses()} please only
394+
* overwrite {@code acceptResolvedAddresses()}. In that method you can indicate if the
395+
* addresses provided by the name resolver are acceptable with the {@code boolean} return
396+
* value.
382397
*/
398+
@Deprecated
383399
public boolean canHandleEmptyAddressListFromNameResolution() {
384400
return false;
385401
}

0 commit comments

Comments
 (0)