@Override public GetDomainNamesResponse nextPage(GetDomainNamesResponse previousPage) { if (previousPage == null) { return client.getDomainNames(firstRequest); } return client.getDomainNames(firstRequest.toBuilder().position(previousPage.position()).build()); } }
@Override public CompletableFuture<GetDomainNamesResponse> nextPage(final GetDomainNamesResponse previousPage) { if (previousPage == null) { return client.getDomainNames(firstRequest); } return client.getDomainNames(firstRequest.toBuilder().position(previousPage.position()).build()); } }
/** * <p> * A helper method to resume the pages in case of unexpected failures. The method takes the last successful response * page as input and returns an instance of {@link GetDomainNamesIterable} that can be used to retrieve the * consecutive pages that follows the input page. * </p> */ private final GetDomainNamesIterable resume(GetDomainNamesResponse lastSuccessfulPage) { if (nextPageFetcher.hasNextPage(lastSuccessfulPage)) { return new GetDomainNamesIterable(client, firstRequest.toBuilder().position(lastSuccessfulPage.position()).build()); } return new GetDomainNamesIterable(client, firstRequest) { @Override public Iterator<GetDomainNamesResponse> iterator() { return Collections.emptyIterator(); } }; }
/** * <p> * A helper method to resume the pages in case of unexpected failures. The method takes the last successful response * page as input and returns an instance of {@link GetDomainNamesPublisher} that can be used to retrieve the * consecutive pages that follows the input page. * </p> */ private final GetDomainNamesPublisher resume(GetDomainNamesResponse lastSuccessfulPage) { if (nextPageFetcher.hasNextPage(lastSuccessfulPage)) { return new GetDomainNamesPublisher(client, firstRequest.toBuilder().position(lastSuccessfulPage.position()).build()); } return new GetDomainNamesPublisher(client, firstRequest, true) { @Override public void subscribe(Subscriber<? super GetDomainNamesResponse> subscriber) { subscriber.onSubscribe(new EmptySubscription(subscriber)); } }; }