summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-09-19 05:47:29 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-09-19 05:47:29 +0000
commit32a236a80b7a7a537ffbd5f10e4a4348c417d3cb (patch)
treea9545babffb6065b74ec11f92d97a752fd81c5d9 /src
parent61496509c09126587b63b193a464fa91f00201b0 (diff)
Restored synchronization and added comment for doing so.
Diffstat (limited to 'src')
-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);