FYI. I’ve just tried to upgrade to the Java SDK 2.6.0, and the following code (from the examples) now returns a TimeoutException when you specify the PersistTo.ONE parameter.
// Generate a number of dummy JSON documents
int docsToCreate = 100;
List<JsonDocument> documents = new ArrayList<JsonDocument>();
for (int i = 0; i < docsToCreate; i++) {
JsonObject content = JsonObject.create()
.put("counter", i)
.put("name", "Foo Bar");
documents.add(JsonDocument.create("doc-"+i, content));
}
// Insert them in one batch, waiting until the last one is done.
Observable
.from(documents)
.flatMap(new Func1<JsonDocument, Observable<JsonDocument>>() {
@Override
public Observable<JsonDocument> call(final JsonDocument docToInsert) {
return bucket.async().insert(docToInsert);
}
})
.last()
.toBlocking()
.single();
Dave.