protected <T> DeferredResult<ResponseEntity<T>> objectResult(ListenableFuture<T> futureResult) { DeferredResult<ResponseEntity<T>> response = new DeferredResult<>( WEB_SERVICE_TIMEOUT, errorResult("Request timeout", HttpStatus.REQUEST_TIMEOUT)); futureResult.addCallback(new SimpleCallback<>(response)); return response; }
protected <T> DeferredResult<ResponseEntity<Map<String, T>>> mapResult( String key, ListenableFuture<T> futureResult) { DeferredResult<ResponseEntity<Map<String, T>>> response = new DeferredResult<>( WEB_SERVICE_TIMEOUT, errorResult("Request timeout", HttpStatus.REQUEST_TIMEOUT)); futureResult.addCallback(new MapCallback<>(key, response)); return response; }