summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-12-16 21:18:15 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-12-16 21:18:15 +0000
commitdef1ccb9ef71ae1aadd62f8f4cb05ac614aee9c1 (patch)
tree17401612ea8aa4990e690b762488a555d3c0cd1a
parent1eaba4475b929d3d8a84212eed1e5c3f5ccb0ca2 (diff)
Handle rare race condition.
-rw-r--r--src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java b/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java
index c7bfc78..21b0676 100644
--- a/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java
+++ b/src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java
@@ -110,7 +110,9 @@ public class SequenceValueGenerator extends AbstractSequenceValueProducer {
mStoredSequence.setInitialValue(initialValue);
// Start as small as possible to allow signed long comparisons to work.
mStoredSequence.setNextValue(Long.MIN_VALUE);
- mStoredSequence.insert();
+ if (!mStoredSequence.tryInsert()) {
+ mStoredSequence.load();
+ }
}
txn.commit();
} finally {