From 81578d7b6798fe5b268d1227cf33d24897d5bdaa Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 23 Oct 2007 01:15:50 +0000 Subject: Support transaction lock timeout. --- .../java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java | 6 ++++++ .../com/amazon/carbonado/repo/sleepycat/BDBTransactionManager.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat') 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 extends AbstractRepository 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 extends TransactionManager { 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); } } -- cgit v1.2.3