From aea108ba2b5f22cf5615bd02d719786e84d359da Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 24 Jan 2012 21:35:01 +0000 Subject: Fix race condition when making initial connection to a slow database. --- .../com/amazon/carbonado/spi/BelatedRepositoryCreator.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/amazon/carbonado/spi') diff --git a/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java b/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java index afb4fba..eeb2b04 100644 --- a/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java +++ b/src/main/java/com/amazon/carbonado/spi/BelatedRepositoryCreator.java @@ -50,6 +50,8 @@ public class BelatedRepositoryCreator extends BelatedCreator mRootRef; + private boolean mRetry; + /** * @param log error reporting log * @param builder builds real Repository @@ -80,9 +82,16 @@ public class BelatedRepositoryCreator extends BelatedCreator rootRef = + mRetry ? new AtomicReference() : mRootRef; + mRetry = true; + Exception error; try { - return mBuilder.build(mRootRef); + return mBuilder.build(rootRef); } catch (SupportException e) { // Cannot recover from this. throw e; -- cgit v1.2.3