aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client-api/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-feed-client-api/src/main')
-rw-r--r--vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java5
-rw-r--r--vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java5
-rw-r--r--vespa-feed-client-api/src/main/java/ai/vespa/feed/client/JsonFeeder.java14
3 files changed, 15 insertions, 9 deletions
diff --git a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java
index d73d36e0f4e..7de7aae1350 100644
--- a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java
+++ b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java
@@ -2,6 +2,7 @@
package ai.vespa.feed.client;
import java.io.Closeable;
+import java.time.Duration;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -74,8 +75,8 @@ public interface FeedClient extends Closeable {
/** Whether to retry operations of the given type. */
default boolean retry(OperationType type) { return true; }
- /** Number of retries per operation for assumed transient, non-backpressure problems. */
- default int retries() { return 10; }
+ /** Maximum number of retries per operation for assumed transient, non-backpressure problems. */
+ default int retries() { return Integer.MAX_VALUE; }
}
diff --git a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java
index 74f906149b2..dd1327f7ccf 100644
--- a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java
+++ b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java
@@ -44,4 +44,9 @@ public class FeedException extends RuntimeException {
public Optional<DocumentId> documentId() { return Optional.ofNullable(documentId); }
+ @Override
+ public String getMessage() {
+ return documentId != null ? "(" + documentId + ") " + super.getMessage() : super.getMessage();
+ }
+
}
diff --git a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/JsonFeeder.java b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/JsonFeeder.java
index 11fb6526210..3111815b332 100644
--- a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/JsonFeeder.java
+++ b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/JsonFeeder.java
@@ -414,7 +414,7 @@ public class JsonFeeder implements Closeable {
abstract String getDocumentJson(long start, long end);
OperationParseException parseException(String error) {
- JsonLocation location = parser.getTokenLocation();
+ JsonLocation location = parser.currentLocation();
return new OperationParseException(error + " at offset " + location.getByteOffset() +
" (line " + location.getLineNr() + ", column " + location.getColumnNr() + ")");
}
@@ -444,13 +444,13 @@ public class JsonFeeder implements Closeable {
case "create": parameters = parameters.createIfNonExistent(readBoolean()); break;
case "fields": {
expect(START_OBJECT);
- start = parser.getTokenLocation().getByteOffset();
+ start = parser.currentTokenLocation().getByteOffset();
int depth = 1;
while (depth > 0) switch (parser.nextToken()) {
case START_OBJECT: ++depth; break;
case END_OBJECT: --depth; break;
}
- end = parser.getTokenLocation().getByteOffset() + 1;
+ end = parser.currentTokenLocation().getByteOffset() + 1;
break;
}
default: throw parseException("Unexpected field name '" + parser.getText() + "'");
@@ -470,7 +470,7 @@ public class JsonFeeder implements Closeable {
if (end >= start)
throw parseException("Illegal 'fields' object for remove operation");
else
- start = end = parser.getTokenLocation().getByteOffset(); // getDocumentJson advances buffer overwrite head.
+ start = end = parser.currentTokenLocation().getByteOffset(); // getDocumentJson advances buffer overwrite head.
}
else if (end < start)
throw parseException("No 'fields' object for document");
@@ -486,14 +486,14 @@ public class JsonFeeder implements Closeable {
private void expect(JsonToken token) throws IOException {
if (parser.nextToken() != token)
- throw new OperationParseException("Expected '" + token + "' at offset " + parser.getTokenLocation().getByteOffset() +
+ throw new OperationParseException("Expected '" + token + "' at offset " + parser.currentTokenLocation().getByteOffset() +
", but found '" + parser.currentToken() + "' (" + parser.getText() + ")");
}
private String readString() throws IOException {
String value = parser.nextTextValue();
if (value == null)
- throw new OperationParseException("Expected '" + JsonToken.VALUE_STRING + "' at offset " + parser.getTokenLocation().getByteOffset() +
+ throw new OperationParseException("Expected '" + JsonToken.VALUE_STRING + "' at offset " + parser.currentTokenLocation().getByteOffset() +
", but found '" + parser.currentToken() + "' (" + parser.getText() + ")");
return value;
@@ -502,7 +502,7 @@ public class JsonFeeder implements Closeable {
private boolean readBoolean() throws IOException {
Boolean value = parser.nextBooleanValue();
if (value == null)
- throw new OperationParseException("Expected '" + JsonToken.VALUE_FALSE + "' or '" + JsonToken.VALUE_TRUE + "' at offset " + parser.getTokenLocation().getByteOffset() +
+ throw new OperationParseException("Expected '" + JsonToken.VALUE_FALSE + "' or '" + JsonToken.VALUE_TRUE + "' at offset " + parser.currentTokenLocation().getByteOffset() +
", but found '" + parser.currentToken() + "' (" + parser.getText() + ")");
return value;