Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit 5fafbea

Browse files
author
Scott Stafford
committed
Addresses #202
1 parent a0bcc5d commit 5fafbea

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

infrastructure/src/main/java/com/marklogic/spring/batch/item/writer/MarkLogicItemWriter.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public class MarkLogicItemWriter extends LoggingObject implements ItemWriter<Doc
2929

3030
private UriTransformer uriTransformer;
3131
private BatchWriter batchWriter;
32+
protected long writeCount = 0;
33+
protected long writeCalled = 0;
3234

3335
public MarkLogicItemWriter(DatabaseClient client) {
3436
this(Arrays.asList(client));
@@ -46,6 +48,8 @@ public MarkLogicItemWriter(BatchWriter batchWriter) {
4648

4749
@Override
4850
public void write(List<? extends DocumentWriteOperation> items) throws Exception {
51+
writeCalled += 1;
52+
writeCount += items.size();
4953
if (uriTransformer != null) {
5054
List<DocumentWriteOperation> newItems = new ArrayList<>();
5155
for (DocumentWriteOperation op : items) {
@@ -57,6 +61,9 @@ public void write(List<? extends DocumentWriteOperation> items) throws Exception
5761
} else {
5862
batchWriter.write(items);
5963
}
64+
if (writeCalled % 250 == 0) {
65+
logger.info("Write Count: " + writeCount);
66+
}
6067
}
6168

6269
@Override
@@ -83,6 +90,7 @@ public void close() throws ItemStreamException {
8390
batchWriter.waitForCompletion();
8491
if (logger.isInfoEnabled()) {
8592
logger.info("On stream close, finished waiting for BatchWriter to complete");
93+
logger.info("Final Write Count: " + writeCount);
8694
}
8795
}
8896

infrastructure/src/main/java/com/marklogic/spring/batch/item/writer/support/TempRestBatchWriter.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
import java.util.Arrays;
1212
import java.util.List;
1313

14-
/**
15-
* Created by sstafford on 1/27/2017.
16-
*/
1714
public class TempRestBatchWriter extends RestBatchWriter {
1815

1916
private Format returnFormat;

0 commit comments

Comments
 (0)