diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2007-09-16 19:02:43 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2007-09-16 19:02:43 +0000 |
commit | d715c111d8a465cd3b32aae68463756b9c1db183 (patch) | |
tree | 9cc947253c9dfa580062529a85ba98e722863936 /src | |
parent | 5f8b8309c9d134836c78d59a9621d06874932191 (diff) |
Ensure that non-destructive update doesn't invoke load trigger.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java index 18f0ea9..b9da366 100644 --- a/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java @@ -536,6 +536,8 @@ public final class MasterStorableGenerator<S extends Storable> { Label failed = b.createLabel();
+ Label tryLoadStart = null, tryLoadEnd = null;
+
if (mFeatures.contains(MasterFeature.UPDATE_FULL)) {
// Storable saved = copy();
b.loadThis();
@@ -544,13 +546,29 @@ public final class MasterStorableGenerator<S extends Storable> { savedVar = b.createLocalVariable(null, mClassFile.getType());
b.storeLocal(savedVar);
- // if (!saved.tryLoad()) {
- // goto failed;
+ // support.locallyDisableLoadTrigger();
+ // try {
+ // if (!saved.tryLoad()) {
+ // goto failed;
+ // }
+ // } finally {
+ // support.locallyEnableLoadTrigger();
// }
+ b.loadThis();
+ b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType);
+ b.invokeInterface(triggerSupportType, "locallyDisableLoadTrigger", null, null);
+
+ tryLoadStart = b.createLabel().setLocation();
b.loadLocal(savedVar);
b.invokeInterface(storableType, TRY_LOAD_METHOD_NAME, TypeDesc.BOOLEAN, null);
+ tryLoadEnd = b.createLabel().setLocation();
+ b.loadThis();
+ b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType);
+ b.invokeInterface(triggerSupportType, "locallyEnableLoadTrigger", null, null);
b.ifZeroComparisonBranch(failed, "==");
+ // Exception handler generated at the end of method.
+
// if (version support enabled) {
// if (!derived version) {
// if (this.getVersionNumber() != saved.getVersionNumber()) {
@@ -706,6 +724,14 @@ public final class MasterStorableGenerator<S extends Storable> { b.loadConstant(false);
b.returnValue(TypeDesc.BOOLEAN);
+ if (tryLoadStart != null) {
+ b.exceptionHandler(tryLoadStart, tryLoadEnd, null);
+ b.loadThis();
+ b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType);
+ b.invokeInterface(triggerSupportType, "locallyEnableLoadTrigger", null, null);
+ b.throwObject();
+ }
+
addExitTransaction(b, UPDATE_OP, txnVar, tryStart);
}
|