use of com.yahoo.documentapi.DocumentAccessException in project vespa by vespa-engine.
the class MessageBusSyncSession method get.
@Override
public Document get(DocumentId id, String fieldSet, DocumentProtocol.Priority pri, Duration timeout) {
GetDocumentMessage msg = new GetDocumentMessage(id, fieldSet);
msg.setPriority(pri);
Reply reply = syncSend(msg, timeout != null ? timeout : defaultTimeout);
if (reply.hasErrors()) {
throw new DocumentAccessException(MessageBusAsyncSession.getErrorMessage(reply));
}
if (reply.getType() != DocumentProtocol.REPLY_GETDOCUMENT) {
throw new DocumentAccessException("Received unknown response: " + reply);
}
GetDocumentReply docReply = ((GetDocumentReply) reply);
Document doc = docReply.getDocument();
if (doc != null) {
doc.setLastModified(docReply.getLastModified());
}
return doc;
}
Aggregations