summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-05-05 09:32:29 (EDT)
committerEike Stepper2008-05-05 09:32:29 (EDT)
commit9bcfea3bd68e795cdb742fd30e4112535733376e (patch)
tree8d486fd9ff5a88ab63daca8dc5ea390689f55407
parent093223e0daf32cf0a265ec14d3b9dd88af45b9f3 (diff)
downloadcdo-9bcfea3bd68e795cdb742fd30e4112535733376e.zip
cdo-9bcfea3bd68e795cdb742fd30e4112535733376e.tar.gz
cdo-9bcfea3bd68e795cdb742fd30e4112535733376e.tar.bz2
[230076] Client is hanging :-(
https://bugs.eclipse.org/bugs/show_bug.cgi?id=230076
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionDeadLockTest.java81
1 files changed, 81 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionDeadLockTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionDeadLockTest.java
index 2226e76..199ae32 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionDeadLockTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionDeadLockTest.java
@@ -19,6 +19,10 @@ import org.eclipse.emf.cdo.tests.model1.Model1Factory;
import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import java.util.ArrayList;
+
/**
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213782
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=201366
@@ -81,4 +85,81 @@ public class TransactionDeadLockTest extends AbstractCDOTest
session.close();
}
+
+ public void testCreateManySessionTransactionMultiThread() throws Exception
+ {
+ final ArrayList<Exception> exceptions = new ArrayList<Exception>();
+ Runnable threadA = new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ msg("Thread Starting");
+ for (int i = 0; i < 100; i++)
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction(new ResourceSetImpl());
+
+ msg("Session + Transaction " + i);
+ transaction.close();
+ session.close();
+ }
+
+ msg("Thread done");
+ }
+ catch (Exception e)
+ {
+ synchronized (exceptions)
+ {
+ exceptions.add(e);
+ }
+ }
+ }
+ };
+
+ ArrayList<Thread> threadList = new ArrayList<Thread>();
+
+ for (int i = 0; i < 5; i++)
+ {
+ threadList.add(new Thread(threadA));
+ }
+
+ for (int i = 0; i < threadList.size(); i++)
+ {
+ threadList.get(i).start();
+ }
+
+ while (true)
+ {
+ int count = 0;
+ for (int i = 0; i < threadList.size(); i++)
+ {
+ if (threadList.get(i).isAlive())
+ {
+ break;
+ }
+
+ count++;
+ }
+
+ if (count == threadList.size())
+ {
+ break;
+ }
+
+ sleep(1000);
+ }
+
+ for (Exception exp : exceptions)
+ {
+ System.out.println();
+ System.out.println();
+ exp.printStackTrace();
+ System.out.println();
+ System.out.println();
+ }
+
+ assertEquals(0, exceptions.size());
+ }
}