@@ -239,6 +239,9 @@ public final void onAddresses(
|
239 | 239 | * {@link ResolutionResult#getAddressesOrError()} is empty, {@link #onError(Status)} will be |
240 | 240 | * called. |
241 | 241 | * |
| 242 | + * <p>Newer NameResolver implementations should prefer calling onResult2. This method exists to |
| 243 | + * facilitate older {@link Listener} implementations to migrate to {@link Listener2}. |
| 244 | + * |
242 | 245 | * @param resolutionResult the resolved server addresses, attributes, and Service Config. |
243 | 246 | * @since 1.21.0 |
244 | 247 | */ |
@@ -248,16 +251,25 @@ public final void onAddresses(
|
248 | 251 | * Handles a name resolving error from the resolver. The listener is responsible for eventually |
249 | 252 | * invoking {@link NameResolver#refresh()} to re-attempt resolution. |
250 | 253 | * |
| 254 | + * <p>New NameResolver implementations should prefer calling onResult2 which will have the |
| 255 | + * address resolution error in {@link ResolutionResult}'s addressesOrError. This method exists |
| 256 | + * to facilitate older implementations using {@link Listener} to migrate to {@link Listener2}. |
| 257 | + * |
251 | 258 | * @param error a non-OK status |
252 | 259 | * @since 1.21.0 |
253 | 260 | */ |
254 | 261 | @Override |
255 | 262 | public abstract void onError(Status error); |
256 | 263 | |
257 | 264 | /** |
258 | | - * Handles updates on resolved addresses and attributes. |
| 265 | + * Handles updates on resolved addresses and attributes. Must be called from the same |
| 266 | + * {@link SynchronizationContext} available in {@link NameResolver.Args} that is passed |
| 267 | + * from the channel. |
259 | 268 | * |
260 | | - * @param resolutionResult the resolved server addresses, attributes, and Service Config. |
| 269 | + * @param resolutionResult the resolved server addresses or error in address resolution, |
| 270 | + * attributes, and Service Config or error |
| 271 | + * @return status indicating whether the resolutionResult was accepted by the listener, |
| 272 | + * typically the result from a load balancer. |
261 | 273 | * @since 1.66 |
262 | 274 | */ |
263 | 275 | public Status onResult2(ResolutionResult resolutionResult) { |
|