summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/amazon/carbonado/cursor/AbstractCursor.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/cursor/AbstractCursor.java b/src/main/java/com/amazon/carbonado/cursor/AbstractCursor.java
index fb34617..cf64a24 100644
--- a/src/main/java/com/amazon/carbonado/cursor/AbstractCursor.java
+++ b/src/main/java/com/amazon/carbonado/cursor/AbstractCursor.java
@@ -64,7 +64,10 @@ public abstract class AbstractCursor<S> implements Cursor<S> {
return list;
}
- public int skipNext(int amount) throws FetchException {
+ public synchronized int skipNext(int amount) throws FetchException {
+ // This method is synchronized to avoid potential race conditions
+ // between calls to hasNext and next in the loop below.
+
if (amount <= 0) {
if (amount < 0) {
throw new IllegalArgumentException("Cannot skip negative amount: " + amount);