use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.
the class Feeder method flushResponseQueue.
void flushResponseQueue() throws InterruptedException {
OperationStatus status = feedReplies.poll();
while (status != null) {
decreasePending(status);
status = feedReplies.poll();
}
}
use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.
the class Feeder method enqueue.
private void enqueue(String id, String message, ErrorCode code, boolean isConditionalNotMet, Message msg) throws InterruptedException {
String traceMessage = msg != null && msg.getTrace() != null && msg.getTrace().getLevel() > 0 ? msg.getTrace().toString() : "";
operations.put(new OperationStatus(message, id, code, isConditionalNotMet, traceMessage));
}
use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.
the class FeedResponse method render.
@Override
public void render(OutputStream output) throws IOException {
int i = 0;
OperationStatus status;
try {
status = operations.take();
while (status.errorCode != ErrorCode.END_OF_FEED) {
output.write(toBytes(status.render()));
if (++i % 5 == 0) {
output.flush();
}
status = operations.take();
}
} catch (InterruptedException e) {
output.flush();
}
}
use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.
the class EndPointResultFactory method parseResult.
private static EndpointResult parseResult(String line, Endpoint endpoint) {
try {
OperationStatus reply = OperationStatus.parse(line);
String message;
if (EMPTY_MESSAGE.equals(reply.message)) {
message = null;
} else {
message = reply.message;
}
Exception exception = null;
if (!reply.errorCode.isSuccess() && message != null) {
exception = new RuntimeException(message);
}
if (reply.traceMessage != null && !reply.traceMessage.isEmpty()) {
log.fine("Got trace message: " + reply.traceMessage);
}
return new EndpointResult(reply.operationId, new Result.Detail(endpoint, replyToResultType(reply), reply.traceMessage, exception));
} catch (Throwable t) {
throw new IllegalArgumentException("Bad result line from server: '" + line + "'", t);
}
}
use of com.yahoo.vespa.http.client.core.OperationStatus in project vespa by vespa-engine.
the class V3MockParsingRequestHandler method respondTransientFailed.
private void respondTransientFailed(PrintWriter responseWriter, String docId) {
final OperationStatus operationStatus = new OperationStatus("Could not put", docId, ErrorCode.TRANSIENT_ERROR, false, "");
writeResponse(responseWriter, operationStatus);
}
Aggregations