From def1ccb9ef71ae1aadd62f8f4cb05ac614aee9c1 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 16 Dec 2006 21:18:15 +0000 Subject: Handle rare race condition. --- src/main/java/com/amazon/carbonado/spi/SequenceValueGenerator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/amazon') 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 { -- cgit v1.2.3