db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1102836 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java
Date Fri, 13 May 2011 18:05:00 GMT
Author: dag
Date: Fri May 13 18:05:00 2011
New Revision: 1102836

URL: http://svn.apache.org/viewvc?rev=1102836&view=rev
Log:
DERBY-5223 Thread's interrupted flag not always preserved after Derby returns from JDBC API
call

Backported from trunk as:
svn merge -c 1102826 https://svn.apache.org/repos/asf/db/derby/code/trunk

Patch DERBY-5223b: This fix moves the initialization of the variable
"interruptedException" earlier in
GenericLanguageConnectionContext#initialize and adds a missing
reinitialization to resetFromPool as a precaution (if
interruptedException is still non-null the connection should have
throws 08000).

The patch also changes the InterruptResilienceTest so that JUnit
asserts in the worker threads will get propagated to the main test
thread on completion, so any future errors in these invariants do not
get overlooked.


Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May 13 18:05:00 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.7:1061570,1061578,1082235
-/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471
+/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1102826

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?rev=1102836&r1=1102835&r2=1102836&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Fri May 13 18:05:00 2011
@@ -377,6 +377,7 @@ public class GenericLanguageConnectionCo
 
     public void initialize() throws StandardException
     {
+        interruptedException = null;
         sessionUser = IdUtil.getUserAuthorizationId(userName);
         //
         //Creating the authorizer authorizes the connection.
@@ -397,9 +398,7 @@ public class GenericLanguageConnectionCo
             }
         }
 
-
         setDefaultSchema(initDefaultSchemaDescriptor());
-        interruptedException = null;
         referencedColumnMap = new WeakHashMap();
     }
 
@@ -808,6 +807,8 @@ public class GenericLanguageConnectionCo
     public void resetFromPool()
          throws StandardException
     {
+        interruptedException = null;
+
         // Reset IDENTITY_VAL_LOCAL
         identityNotNull = false;
 

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java?rev=1102836&r1=1102835&r2=1102836&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/InterruptResilienceTest.java
Fri May 13 18:05:00 2011
@@ -369,7 +369,7 @@ public class InterruptResilienceTest ext
     static class WorkerThread extends Thread {
         private final boolean readertest;
         private final long noOps;
-        public Exception e; // if any seen
+        public Throwable e; // if any seen
         private Connection c;
 
         public WorkerThread(Connection c, boolean readertest, long noOps) {
@@ -432,7 +432,7 @@ public class InterruptResilienceTest ext
                                 retries++;
                                 continue;
                             } else {
-                                throw new Exception("expected 08000, saw" + e);
+                                fail("expected 08000", e);
                             }
                         }
 
@@ -459,7 +459,7 @@ public class InterruptResilienceTest ext
                                 retries++;
                                 continue;
                             } else {
-                                throw new Exception("expected 08000, saw" + e);
+                                fail("expected 08000", e);
                             }
                         }
 
@@ -476,7 +476,7 @@ public class InterruptResilienceTest ext
                     }
                 }
                 s.close();
-            } catch (Exception e) {
+            } catch (Throwable e) {
                 this.e = e;
             } finally {
                 try { c.close(); } catch (Exception e) {}



Mime
View raw message