diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2011-01-06 22:15:03 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2011-01-06 22:15:03 +0000 |
commit | c040b7cfb3bdccf0a00b496adffc4c0b29cfc379 (patch) | |
tree | 7e7a86c2c70635710833725dee071774b98bb65e | |
parent | 9af8c1b1bf278c4895913ca2c944ee862cc8adf7 (diff) |
Log when generating new layout generation.
-rw-r--r-- | src/main/java/com/amazon/carbonado/layout/LayoutFactory.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java b/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java index 4457ee0..c52d0b8 100644 --- a/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java +++ b/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java @@ -29,6 +29,8 @@ import java.lang.reflect.Method; import java.util.Arrays;
import java.util.Map;
+import org.apache.commons.logging.LogFactory;
+
import com.amazon.carbonado.Cursor;
import com.amazon.carbonado.FetchDeadlockException;
import com.amazon.carbonado.FetchException;
@@ -165,10 +167,12 @@ public class LayoutFactory implements LayoutCapability { wait();
}
if (fetchEx != null) {
- throw fetchEx;
+ // Wrap to get complete stack trace.
+ throw new FetchException(fetchEx);
}
if (persistEx != null) {
- throw persistEx;
+ // Wrap to get complete stack trace.
+ throw new PersistException(persistEx);
}
return layout;
}
@@ -269,8 +273,9 @@ public class LayoutFactory implements LayoutCapability { .orderBy("-generation")
.fetch();
+ boolean newGen;
try {
- if (cursor.hasNext()) {
+ if (newGen = cursor.hasNext()) {
generation = cursor.next().getGeneration() + 1;
}
} finally {
@@ -280,6 +285,11 @@ public class LayoutFactory implements LayoutCapability { newLayout.insert(readOnly, generation);
layout = newLayout;
+ if (newGen) {
+ LogFactory.getLog(getClass())
+ .debug("New schema layout inserted: " + layout);
+ }
+
txn.commit();
} finally {
txn.exit();
|