diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2012-01-23 17:50:09 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2012-01-23 17:50:09 +0000 |
commit | b064024b4e3c9a7cd45fc295cc1da54028db1d7f (patch) | |
tree | b8397681a4c845f46dd3d3cf6613af76fb9ec434 /src | |
parent | 88cef0977ef84997b20be85acfac1c3b269fde1c (diff) |
Fix race condition when making initial connection to a slow database.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java index 17beb2e..a24cffe 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java @@ -82,8 +82,11 @@ public class ReplicatedRepositoryBuilder extends AbstractRepositoryBuilder { mMasterRepositoryBuilder.setMaster(mIsMaster);
Log log = LogFactory.getLog(ReplicatedRepositoryBuilder.class);
+ // Pass a dummy root reference, to prevent it from overriding the
+ // true root, which is a ReplicatedRepository.
+ AtomicReference<Repository> dummyRef = new AtomicReference<Repository>();
BelatedRepositoryCreator creator = new BelatedRepositoryCreator
- (log, mMasterRepositoryBuilder, rootRef, DEFAULT_RETRY_MILLIS) {
+ (log, mMasterRepositoryBuilder, dummyRef, DEFAULT_RETRY_MILLIS) {
@Override
protected void createdNotification(Repository repo) {
|