diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2012-01-26 02:53:21 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2012-01-26 02:53:21 +0000 |
commit | bf9c0e6ce8568d0e37ea1d2947aba141ae4c7fe4 (patch) | |
tree | 26b07a042caf2812c2e352286871d192d57ec625 /src/main/java/com/amazon/carbonado/repo/indexed | |
parent | e640c47ae16d9d375010a18facd8a5bf4bd5c83e (diff) |
Added option for index access to fetch ahead to reduce likelihood of deadlocks.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/indexed')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java index bce6975..04eb478 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedCursor.java @@ -32,6 +32,7 @@ import com.amazon.carbonado.Storage; import com.amazon.carbonado.Transaction;
import com.amazon.carbonado.cursor.AbstractCursor;
+import com.amazon.carbonado.cursor.FetchAheadCursor;
import com.amazon.carbonado.spi.RepairExecutor;
@@ -44,6 +45,13 @@ import com.amazon.carbonado.synthetic.SyntheticStorableReferenceAccess; * @author Brian S O'Neill
*/
class IndexedCursor<S extends Storable> extends AbstractCursor<S> {
+ private static final int FETCH_AHEAD;
+
+ static {
+ String prefix = IndexedCursor.class.getName() + '.';
+ FETCH_AHEAD = Integer.getInteger(prefix + "fetchAhead", 0);
+ }
+
private final Cursor<? extends Storable> mCursor;
private final IndexedStorage<S> mStorage;
private final SyntheticStorableReferenceAccess<S> mAccessor;
@@ -52,7 +60,11 @@ class IndexedCursor<S extends Storable> extends AbstractCursor<S> { IndexedCursor(Cursor<? extends Storable> indexEntryCursor,
IndexedStorage<S> storage,
- SyntheticStorableReferenceAccess<S> indexAccessor) {
+ SyntheticStorableReferenceAccess<S> indexAccessor)
+ {
+ if (FETCH_AHEAD > 0) {
+ indexEntryCursor = new FetchAheadCursor(indexEntryCursor, FETCH_AHEAD);
+ }
mCursor = indexEntryCursor;
mStorage = storage;
mAccessor = indexAccessor;
|