jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r793240 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core: UserTransactionImpl.java state/TimeBomb.java
Date Sat, 11 Jul 2009 23:07:26 GMT
Author: jukka
Date: Sat Jul 11 23:07:25 2009
New Revision: 793240

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

Increase the block detection timeout.

Use Thread.join(long) instead of the more complicated TimeBomb mechanism.

Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/TimeBomb.java
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=793240&r1=793239&r2=793240&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
Sat Jul 11 23:07:25 2009
@@ -29,7 +29,6 @@
 import javax.jcr.Session;
 
 import org.apache.jackrabbit.api.XASession;
-import org.apache.jackrabbit.core.state.TimeBomb;
 
 /**
  * Internal {@link javax.transaction.UserTransaction} implementation.
@@ -124,27 +123,20 @@
             status = Status.STATUS_COMMITTING;
             if (distributedThreadAccess) {
                 try {
-                    final Thread t = Thread.currentThread();
-                    final TimeBomb tb = new TimeBomb(100) {
-                        public void explode() {
-                            t.interrupt();
-                        }
-                    };
-                    tb.arm();
                     Thread distributedThread = new Thread() {
                         public void run() {
                             try {
                                 xares.commit(xid, false);
-                                tb.disarm();                
                             } catch (Exception e) {
                                 throw new RuntimeException(e.getMessage());
                             }
                         }
                     };
                     distributedThread.start();
-                    Thread.sleep(200);
+                    distributedThread.join(1000);
                 } catch (InterruptedException e) {
-                    throw new SystemException("commit from different thread but same XID
must not block");
+                    throw new SystemException(
+                            "Commit from different thread but same XID must not block");
                 }
             } else {
                 xares.commit(xid, false);



Mime
View raw message