jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r816124 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java
Date Thu, 17 Sep 2009 10:16:47 GMT
Author: jukka
Date: Thu Sep 17 10:16:46 2009
New Revision: 816124

URL: http://svn.apache.org/viewvc?rev=816124&view=rev
Log:
JCR-2207: XATest error: commit from different thread but same XID must not block

Fixed a problem in the thread timeout code. Thanks, Claus, for the catch!

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java?rev=816124&r1=816123&r2=816124&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java
Thu Sep 17 10:16:46 2009
@@ -122,19 +122,18 @@
 
             status = Status.STATUS_COMMITTING;
             if (distributedThreadAccess) {
-                try {
-                    Thread distributedThread = new Thread() {
-                        public void run() {
-                            try {
-                                xares.commit(xid, false);
-                            } catch (Exception e) {
-                                throw new RuntimeException(e.getMessage());
-                            }
+                Thread distributedThread = new Thread() {
+                    public void run() {
+                        try {
+                            xares.commit(xid, false);
+                        } catch (Exception e) {
+                            throw new RuntimeException(e.getMessage());
                         }
-                    };
-                    distributedThread.start();
-                    distributedThread.join(1000);
-                } catch (InterruptedException e) {
+                    }
+                };
+                distributedThread.start();
+                distributedThread.join(1000);
+                if (distributedThread.isAlive()) {
                     throw new SystemException(
                             "Commit from different thread but same XID must not block");
                 }
@@ -158,6 +157,8 @@
                 se.initCause(e.getCause());
                 throw se;
             }
+        } catch (InterruptedException e) {
+            throw new SystemException("Thread.join() interrupted");
         }
     }
 



Mime
View raw message