diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2006-12-16 21:18:15 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2006-12-16 21:18:15 +0000 |
commit | def1ccb9ef71ae1aadd62f8f4cb05ac614aee9c1 (patch) | |
tree | 17401612ea8aa4990e690b762488a555d3c0cd1a /src | |
parent | 1eaba4475b929d3d8a84212eed1e5c3f5ccb0ca2 (diff) |
Handle rare race condition.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java | 4 |
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 {
|