dsmiley commented on code in PR #4046:
URL: https://github.com/apache/solr/pull/4046#discussion_r2692335516
##########
solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java:
##########
@@ -421,22 +420,28 @@ protected static CoreStatusResponse.SingleCoreData
getCoreStatus(Replica replica
}
protected CollectionAdminRequest.RequestStatusResponse
waitForAsyncClusterRequest(
- String asyncId, Duration timeout)
- throws SolrServerException, IOException, InterruptedException {
- CollectionAdminRequest.RequestStatus requestStatus =
+ String asyncId, Duration timeout) throws InterruptedException {
+ final CollectionAdminRequest.RequestStatus requestStatus =
CollectionAdminRequest.requestStatus(asyncId);
- CollectionAdminRequest.RequestStatusResponse rsp = null;
- TimeOut timeoutCheck = new TimeOut(timeout, TimeSource.NANO_TIME);
- while (!timeoutCheck.hasTimedOut()) {
- rsp = requestStatus.process(cluster.getSolrClient());
- if (rsp.getRequestStatus() == RequestStatusState.FAILED
- || rsp.getRequestStatus() == RequestStatusState.COMPLETED) {
- return rsp;
- }
- Thread.sleep(50);
- }
- fail("Async request " + asyncId + " did not complete within duration: " +
timeout.toString());
- return rsp;
+ final AtomicReference<CollectionAdminRequest.RequestStatusResponse> rsp =
Review Comment:
This looks worse. I guess TimeOut is simpler in part due to no try-catch
needed in some cases (like this) and no AtomicReference needed either. Dodging
the try-catch need is unusual... normally a failing request propagates an
exception but I see the API you are using doesn't do that. I think that's a
known GAP in our APIs that I had been chatting with Jason about solving.
Any way, do as you please.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]