summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/amazon/carbonado/layout/LayoutFactory.java16
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();