use of com.yahoo.vespa.config.Connection in project vespa by vespa-engine.
the class FileReferenceDownloader method startDownloadRpc.
private boolean startDownloadRpc(FileReferenceDownload fileReferenceDownload) {
Connection connection = connectionPool.getCurrent();
Request request = new Request("filedistribution.serveFile");
String fileReference = fileReferenceDownload.fileReference().value();
request.parameters().add(new StringValue(fileReference));
request.parameters().add(new Int32Value(fileReferenceDownload.downloadFromOtherSourceIfNotFound() ? 0 : 1));
execute(request, connection);
if (validateResponse(request)) {
log.log(LogLevel.DEBUG, () -> "Request callback, OK. Req: " + request + "\nSpec: " + connection);
if (request.returnValues().get(0).asInt32() == 0) {
log.log(LogLevel.DEBUG, () -> "Found file reference '" + fileReference + "' available at " + connection.getAddress());
return true;
} else {
log.log(LogLevel.DEBUG, "File reference '" + fileReference + "' not found for " + connection.getAddress());
connectionPool.setNewCurrentConnection();
return false;
}
} else {
log.log(LogLevel.DEBUG, "Request failed. Req: " + request + "\nSpec: " + connection.getAddress() + ", error code: " + request.errorCode() + ", set error for connection and use another for next request");
connectionPool.setError(connection, request.errorCode());
return false;
}
}
Aggregations