internalResolve(hostname, promise); } else { final boolean startWithoutSearchDomain = hasNDots(); final String initialHostname = startWithoutSearchDomain ? hostname : hostname + '.' + searchDomains[0]; final int initialSearchDomainIdx = startWithoutSearchDomain ? 0 : 1;
internalResolve(hostname, promise); } else { final boolean startWithoutSearchDomain = hasNDots(); final String initialHostname = startWithoutSearchDomain ? hostname : hostname + '.' + searchDomains[0]; final int initialSearchDomainIdx = startWithoutSearchDomain ? 0 : 1;
void resolve(final Promise<List<T>> promise) { final String[] searchDomains = parent.searchDomains(); if (searchDomains.length == 0 || parent.ndots() == 0 || StringUtil.endsWith(hostname, '.')) { internalResolve(promise); } else { final boolean startWithoutSearchDomain = hasNDots(); final String initialHostname = startWithoutSearchDomain ? hostname : hostname + '.' + searchDomains[0]; final int initialSearchDomainIdx = startWithoutSearchDomain ? 0 : 1; doSearchDomainQuery(initialHostname, new FutureListener<List<T>>() { private int searchDomainIdx = initialSearchDomainIdx; @Override public void operationComplete(Future<List<T>> future) { Throwable cause = future.cause(); if (cause == null) { promise.trySuccess(future.getNow()); } else { if (DnsNameResolver.isTransportOrTimeoutError(cause)) { promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname)); } else if (searchDomainIdx < searchDomains.length) { doSearchDomainQuery(hostname + '.' + searchDomains[searchDomainIdx++], this); } else if (!startWithoutSearchDomain) { internalResolve(promise); } else { promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname)); } } } }); } }
internalResolve(hostname, promise); } else { final boolean startWithoutSearchDomain = hasNDots(); final String initialHostname = startWithoutSearchDomain ? hostname : hostname + '.' + searchDomains[0]; final int initialSearchDomainIdx = startWithoutSearchDomain ? 0 : 1;