db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r892912 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java
Date Mon, 21 Dec 2009 18:14:48 GMT
Author: kahatlen
Date: Mon Dec 21 18:14:47 2009
New Revision: 892912

URL: http://svn.apache.org/viewvc?rev=892912&view=rev
Log:
DERBY-3757: ASSERT FAILED transaction table has null entry when running new StressMultiTest

Synchronize on the Hashtable to prevent concurrent modification while
iterating over the elements.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java?rev=892912&r1=892911&r2=892912&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/TransactionTable.java
Mon Dec 21 18:14:47 2009
@@ -947,7 +947,14 @@
 		if (SanityManager.DEBUG)
 			SanityManager.DEBUG("TranTrace", toString());
 
-		synchronized(this)
+        // Synchronize on trans to prevent problems that could occur if
+        // elements are added to or removed from the Hashtable while we're
+        // looping through the elements. Possible problems include:
+        //   - ArrayIndexOutOfBoundsException if a transaction is added after
+        //     the call to trans.size()
+        //   - Assert failure, tx table has null entry (DERBY-3757)
+        //   - NoSuchElementException (DERBY-3916)
+        synchronized (trans)
 		{
 			int ntran = trans.size();
 			tinfo = new TransactionTableEntry[ntran];



Mime
View raw message