summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2012-12-31 22:07:53 +0000
committerBrian S. O'Neill <bronee@gmail.com>2012-12-31 22:07:53 +0000
commitf9d2dbbc2f5640708a1f07469cd99874734daef1 (patch)
tree9b476fa3b9e90401fc508fc5cdffe8bcbba9496c /src/main/java
parent341e3975fefdf5e2fb9a62cdf762af7738657ee6 (diff)
Ensure that trigger runs with "try" variants and still has access to the transaction.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java5
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java10
2 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java b/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java
index bcb866b..8f2afde 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java
@@ -75,6 +75,11 @@ class DerivedIndexesTrigger<S extends Storable, D extends Storable> extends Trig
}
@Override
+ public Object beforeTryDelete(Transaction txn, S storable) throws PersistException {
+ return beforeDelete(txn, storable);
+ }
+
+ @Override
public Object beforeDelete(Transaction txn, S storable) throws PersistException {
txn.setForUpdate(true);
try {
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java
index 67f29e8..4c5840a 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java
@@ -64,6 +64,11 @@ class IndexesTrigger<S extends Storable> extends Trigger<S> {
}
@Override
+ public Object beforeTryUpdate(Transaction txn, S storable) throws PersistException {
+ return beforeUpdate(txn, storable);
+ }
+
+ @Override
public Object beforeUpdate(Transaction txn, S storable) throws PersistException {
// Ensure old storable is loaded with an upgradable lock, allowing
// update to proceed without deadlock.
@@ -93,6 +98,11 @@ class IndexesTrigger<S extends Storable> extends Trigger<S> {
}
@Override
+ public Object beforeTryDelete(Transaction txn, S storable) throws PersistException {
+ return beforeDelete(txn, storable);
+ }
+
+ @Override
public Object beforeDelete(Transaction txn, S storable) throws PersistException {
// Ensure old storable is loaded with an upgradable lock, allowing
// delete to proceed without deadlock.