From f9d2dbbc2f5640708a1f07469cd99874734daef1 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 31 Dec 2012 22:07:53 +0000 Subject: Ensure that trigger runs with "try" variants and still has access to the transaction. --- .../amazon/carbonado/repo/indexed/DerivedIndexesTrigger.java | 5 +++++ .../java/com/amazon/carbonado/repo/indexed/IndexesTrigger.java | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/main/java/com/amazon/carbonado/repo') 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 @@ -74,6 +74,11 @@ class DerivedIndexesTrigger extends Trig updateValues(storable, state); } + @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); 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 @@ -63,6 +63,11 @@ class IndexesTrigger extends Trigger { } } + @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 @@ -92,6 +97,11 @@ class IndexesTrigger extends Trigger { } } + @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 -- cgit v1.2.3