You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/01/19 18:16:35 UTC

svn commit: r1725570 - in /qpid/java/branches/6.0.x: ./ bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/

Author: orudyy
Date: Tue Jan 19 17:16:35 2016
New Revision: 1725570

URL: http://svn.apache.org/viewvc?rev=1725570&view=rev
Log:
QPID-6999: Throw ConnectionScopeRuntimeException for IllegalStateException thrown from JE Environment on commits for aborted transactions

         merged from trunk
         svn merge -c 1725569 https://svn.apache.org/repos/asf/qpid/java/trunk

Modified:
    qpid/java/branches/6.0.x/   (props changed)
    qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java
    qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java

Propchange: qpid/java/branches/6.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 19 17:16:35 2016
@@ -9,5 +9,5 @@
 /qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
 /qpid/branches/java-network-refactor/qpid/java:805429-821809
 /qpid/branches/qpid-2935/qpid/java:1061302-1072333
-/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1718889,1718893,1718918,1718922,1719026,1719028,1719033,1719037,1719047,1719051,1720664,1721151,1721198,1722246,1722339,1723064,1723194,1723563,1724216,1724251,1724257,1724397,1724432,1724582,1724603,1724780,1724843-1724844,1725295
+/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1718889,1718893,1718918,1718922,1719026,1719028,1719033,1719037,1719047,1719051,1720664,1721151,1721198,1722246,1722339,1723064,1723194,1723563,1724216,1724251,1724257,1724397,1724432,1724582,1724603,1724780,1724843-1724844,1725295,1725569
 /qpid/trunk/qpid:796646-796653

Modified: qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java?rev=1725570&r1=1725569&r2=1725570&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java (original)
+++ qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java Tue Jan 19 17:16:35 2016
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.qpid.server.store.StoreException;
 import org.apache.qpid.server.store.berkeleydb.logging.Slf4jLoggingHandler;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 
 public class StandardEnvironmentFacade implements EnvironmentFacade
 {
@@ -140,13 +141,12 @@ public class StandardEnvironmentFacade i
         {
             tx.commitNoSync();
         }
-        catch (DatabaseException de)
+        catch (RuntimeException de)
         {
             LOGGER.error("Got DatabaseException on commit, closing environment", de);
 
             closeEnvironmentSafely();
-
-            throw handleDatabaseException("Got DatabaseException on commit", de);
+            handleCommitException(tx, de);
         }
         _committer.commit(tx, syncCommit);
     }
@@ -158,13 +158,12 @@ public class StandardEnvironmentFacade i
         {
             tx.commitNoSync();
         }
-        catch (DatabaseException de)
+        catch (RuntimeException de)
         {
             LOGGER.error("Got DatabaseException on commit, closing environment", de);
 
             closeEnvironmentSafely();
-
-            throw handleDatabaseException("Got DatabaseException on commit", de);
+            handleCommitException(tx, de);
         }
         return _committer.commitAsync(tx, val);
     }
@@ -441,4 +440,16 @@ public class StandardEnvironmentFacade i
             cachedHandle.close();
         }
     }
+
+    private void handleCommitException(final Transaction tx, RuntimeException e)
+    {
+        if (e instanceof IllegalStateException && !tx.isValid())
+        {
+            throw new ConnectionScopedRuntimeException("Commit aborted", e);
+        }
+        else
+        {
+            throw handleDatabaseException("Commit failed", e);
+        }
+    }
 }

Modified: qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java?rev=1725570&r1=1725569&r2=1725570&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java (original)
+++ qpid/java/branches/6.0.x/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java Tue Jan 19 17:16:35 2016
@@ -279,9 +279,9 @@ public class ReplicatedEnvironmentFacade
             // the HA durability configuration to influence resulting behaviour.
             tx.commit(_realMessageStoreDurability);
         }
-        catch (DatabaseException de)
+        catch (RuntimeException de)
         {
-            throw handleDatabaseException("Got DatabaseException on commit, closing environment", de);
+            handleCommitException(tx, de);
         }
 
         if (_coalescingCommiter != null && _realMessageStoreDurability.getLocalSync() == SyncPolicy.NO_SYNC
@@ -301,9 +301,9 @@ public class ReplicatedEnvironmentFacade
             // the HA durability configuration to influence resulting behaviour.
             tx.commit(_realMessageStoreDurability);
         }
-        catch (DatabaseException de)
+        catch (RuntimeException de)
         {
-            throw handleDatabaseException("Got DatabaseException on commit, closing environment", de);
+            handleCommitException(tx, de);
         }
 
         if (_coalescingCommiter != null && _realMessageStoreDurability.getLocalSync() == SyncPolicy.NO_SYNC
@@ -1823,6 +1823,18 @@ public class ReplicatedEnvironmentFacade
         }
     }
 
+    private void handleCommitException(final Transaction tx, RuntimeException e)
+    {
+        if (e instanceof IllegalStateException && !tx.isValid())
+        {
+            throw new ConnectionScopedRuntimeException("Commit aborted", e);
+        }
+        else
+        {
+            throw handleDatabaseException("Commit failed", e);
+        }
+    }
+
 
     private class RemoteNodeStateLearner implements Callable<Void>
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org