Author: dblevins
Date: Tue Dec 29 01:05:54 2009
New Revision: 894289
URL: http://svn.apache.org/viewvc?rev=894289&view=rev
Log:
Test should fail now in a way that truly identifies the condition. Will fix it
fix it once we can see that it behaves correctly.
Modified:
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonLazyInstantiationTest.java
Modified:
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonLazyInstantiationTest.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonLazyInstantiationTest.java?rev=894289&r1=894288&r2=894289&view=diff
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonLazyInstantiationTest.java
(original)
+++
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonLazyInstantiationTest.java
Tue Dec 29 01:05:54 2009
@@ -72,7 +72,7 @@
Context context = new InitialContext();
int threads = 2000;
- CyclicBarrier start = new CyclicBarrier(threads);
+ CyclicBarrier start = new CyclicBarrier(threads + 1);
CountDownLatch finish = new CountDownLatch(threads);
for (int i = threads; i > 0; i--) {
@@ -81,6 +81,10 @@
thread.start();
}
+ start.await(30, TimeUnit.SECONDS);
+
+ assertFalse("All threads did not start", start.isBroken());
+
assertTrue("Client threads did not complete", finish.await(30,
TimeUnit.SECONDS));
assertEquals("incorrect number of instances", 1,
MySingleton.instances.get());
@@ -100,7 +104,7 @@
Context context = new InitialContext();
int threads = 200;
- CyclicBarrier start = new CyclicBarrier(threads);
+ CyclicBarrier start = new CyclicBarrier(threads + 1);
CountDownLatch finish = new CountDownLatch(threads);
for (int i = threads; i > 0; i--) {
@@ -109,6 +113,10 @@
thread.start();
}
+ start.await(30, TimeUnit.SECONDS);
+
+ assertFalse("All threads did not start", start.isBroken());
+
assertTrue("Client threads did not complete", finish.await(30,
TimeUnit.SECONDS));
assertEquals("incorrect number of instances", 1,
MySingleton.instances.get());
@@ -171,7 +179,7 @@
}
public static void log(String s) {
- System.out.println(Thread.currentThread().getName() + " : " + s);
+// System.out.println(Thread.currentThread().getName() + " : " + s);
}