use of com.linkedin.kafka.cruisecontrol.servlet.response.ProgressResult in project cruise-control by linkedin.
the class AbstractAsyncRequest method getResponse.
@Override
public CruiseControlResponse getResponse(HttpServletRequest request, HttpServletResponse response) throws ExecutionException, InterruptedException {
LOG.info("Processing async request {}.", name());
int step = _asyncOperationStep.get();
List<OperationFuture> futures = _userTaskManager.getOrCreateUserTask(request, response, this::handle, step, true, parameters());
_asyncOperationStep.set(step + 1);
CruiseControlResponse ccResponse;
try {
ccResponse = futures.get(step).get(_maxBlockMs, TimeUnit.MILLISECONDS);
LOG.info("Computation is completed for async request: {}.", request.getPathInfo());
} catch (TimeoutException te) {
ccResponse = new ProgressResult(futures, _asyncKafkaCruiseControl.config());
LOG.info("Computation is in progress for async request: {}.", request.getPathInfo());
}
return ccResponse;
}
Aggregations