From bcfaaffa3751f8c7883e41c162ba4030fd9bd21a Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Fri, 25 Oct 2013 01:36:27 +0000 Subject: Fixing ReplicatedRepository so that transactions may be entered when the master is unavailable as long as no changes are made to replicated storables. --- src/main/java/com/amazon/carbonado/layout/LayoutFactory.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/amazon/carbonado/layout') diff --git a/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java b/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java index c4333da..9788739 100644 --- a/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java +++ b/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java @@ -148,6 +148,7 @@ public class LayoutFactory implements LayoutCapability { private Layout layout; private FetchException fetchEx; private PersistException persistEx; + private RuntimeException runtimeEx; public synchronized void run() { try { @@ -157,6 +158,11 @@ public class LayoutFactory implements LayoutCapability { fetchEx = e; } catch (PersistException e) { persistEx = e; + } catch (RuntimeException e) { + // This is a catchall for any other exception which + // might happen so that it doesn't get absorbed by + // this thread. + runtimeEx = e; } } finally { done = true; @@ -178,6 +184,10 @@ public class LayoutFactory implements LayoutCapability { // Wrap to get complete stack trace. throw new PersistException(persistEx); } + if (runtimeEx != null) { + // Wrap to get complete stack trace. + throw new RuntimeException(runtimeEx); + } return layout; } } @@ -303,7 +313,7 @@ public class LayoutFactory implements LayoutCapability { } throw e; } catch (PersistException e) { - if (e instanceof PersistDeadlockException || e instanceof PersistTimeoutException){ + if (e instanceof PersistDeadlockException || e instanceof PersistTimeoutException) { // Might be caused by coarse locks. Switch to nested // transaction to share the locks. if (top) { -- cgit v1.2.3