Starts the resolution. The method is not supposed to throw any exceptions. That might cause the Channel that the name resolver is serving to crash. Errors should be propagated through Listener#onError. An instance may not be started more than once, by any overload of this method, even af
(final Listener listener)
| 85 | * @since 1.0.0 |
| 86 | */ |
| 87 | public void start(final Listener listener) { |
| 88 | if (listener instanceof Listener2) { |
| 89 | start((Listener2) listener); |
| 90 | } else { |
| 91 | start(new Listener2() { |
| 92 | @Override |
| 93 | public void onError(Status error) { |
| 94 | listener.onError(error); |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public void onResult(ResolutionResult resolutionResult) { |
| 99 | StatusOr<List<EquivalentAddressGroup>> addressesOrError = |
| 100 | resolutionResult.getAddressesOrError(); |
| 101 | if (addressesOrError.hasValue()) { |
| 102 | listener.onAddresses(addressesOrError.getValue(), |
| 103 | resolutionResult.getAttributes()); |
| 104 | } else { |
| 105 | listener.onError(addressesOrError.getStatus()); |
| 106 | } |
| 107 | } |
| 108 | }); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Starts the resolution. The method is not supposed to throw any exceptions. That might cause the |
no outgoing calls