summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-10-23 01:15:50 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-10-23 01:15:50 +0000
commit81578d7b6798fe5b268d1227cf33d24897d5bdaa (patch)
tree1ea27197901300cb8e0baad88e0e2bcd88d97d33 /src/main/java/com
parentd32c45550f55b2bff556dbb139df8ac95edc6fa0 (diff)
Support transaction lock timeout.
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java6
-rw-r--r--src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
index 0e2ed96..45fe85c 100644
--- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.logging.Log;
@@ -440,6 +441,11 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn>
abstract Txn txn_begin(Txn parent, IsolationLevel level) throws Exception;
+ // Subclass should override this method to actually apply the timeout
+ Txn txn_begin(Txn parent, IsolationLevel level, int timeout, TimeUnit unit) throws Exception {
+ return txn_begin(parent, level);
+ }
+
abstract Txn txn_begin_nowait(Txn parent, IsolationLevel level) throws Exception;
abstract void txn_commit(Txn txn) throws Exception;
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java
index 53ca5e4..58a9e8d 100644
--- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java
+++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java
@@ -65,7 +65,7 @@ class BDBTransactionManager<Txn> extends TransactionManager<Txn> {
if (timeout == 0) {
return repository().txn_begin_nowait(parent, level);
} else {
- return repository().txn_begin(parent, level);
+ return repository().txn_begin(parent, level, timeout, unit);
}
}