From c040b7cfb3bdccf0a00b496adffc4c0b29cfc379 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 6 Jan 2011 22:15:03 +0000 Subject: Log when generating new layout generation. --- .../java/com/amazon/carbonado/layout/LayoutFactory.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') 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(); -- cgit v1.2.3