[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/lease/synchronization ...
Ron Sigal
ron_sigal at yahoo.com
Mon Nov 5 03:23:06 EST 2007
User: rsigal
Date: 07/11/05 03:23:06
Modified: src/tests/org/jboss/test/remoting/lease/synchronization
Tag: remoting_2_x
MultipleClientSynchronizationTestCase.java
Log:
JBREM-800: Changed busy waits to waiting on locks.
Revision Changes Path
No revision
No revision
1.1.2.5 +57 -17 JBossRemoting/src/tests/org/jboss/test/remoting/lease/synchronization/Attic/MultipleClientSynchronizationTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultipleClientSynchronizationTestCase.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/lease/synchronization/Attic/MultipleClientSynchronizationTestCase.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- MultipleClientSynchronizationTestCase.java 2 Nov 2007 19:06:59 -0000 1.1.2.4
+++ MultipleClientSynchronizationTestCase.java 5 Nov 2007 08:23:05 -0000 1.1.2.5
@@ -48,7 +48,7 @@
/**
*
* @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1.2.4 $
+ * @version $Revision: 1.1.2.5 $
* <p>
* Copyright Jul 31, 2007
* </p>
@@ -107,7 +107,11 @@
threads[i].start();
}
+ synchronized (go1)
+ {
go1.value = true;
+ go1.notifyAll();
+ }
Thread.sleep(5000);
// Stop clients 0..499 and start clients 500..999.
@@ -117,12 +121,25 @@
threads[i].start();
}
+ synchronized (stop1)
+ {
stop1.value = true;
+ stop1.notifyAll();
+ }
+ synchronized (go2)
+ {
go2.value = true;
+ go2.notifyAll();
+ }
+
Thread.sleep(5000);
// Stop clients 500..999.
+ synchronized (stop2)
+ {
stop2.value = true;
+ stop2.notifyAll();
+ }
// Wait for clients to disconnect.
for (int i = 0; i < 30; i++)
@@ -178,11 +195,19 @@
threads[i].start();
}
+ synchronized (go1)
+ {
go1.value = true;
+ go1.notifyAll();
+ }
Thread.sleep(5000);
// Stop clients 0..499.
+ synchronized (stop1)
+ {
stop1.value = true;
+ stop1.notifyAll();
+ }
// Start clients 500..999.
for (int i = INVOCATIONS / 2; i < INVOCATIONS; i++)
@@ -191,11 +216,20 @@
threads[i].start();
}
+ synchronized (go2)
+ {
go2.value = true;
+ go2.notifyAll();
+ }
+
Thread.sleep(5000);
// Stop clients 500..999.
+ synchronized (stop2)
+ {
stop2.value = true;
+ stop2.notifyAll();
+ }
// Wait for clients to disconnect.
for (int i = 0; i < 30; i++)
@@ -254,11 +288,13 @@
{
try
{
+ synchronized (startFlag)
+ {
while (!startFlag.value)
{
- try {Thread.sleep(100);} catch (InterruptedException e) {}
+ try {startFlag.wait();} catch (InterruptedException e) {}
+ }
}
-
log.debug("client got start flag (" + id + "): " + client.getSessionId());
client.connect();
log.debug("client connected (" + id + "): " + client.getSessionId());
@@ -271,9 +307,13 @@
try
{
log.debug("client waiting for stop flag (" + id + "): " + client.getSessionId());
+
+ synchronized (stopFlag)
+ {
while (!stopFlag.value)
{
- try {Thread.sleep(100);} catch (InterruptedException e) {}
+ try {stopFlag.wait();} catch (InterruptedException e) {}
+ }
}
log.debug("client got stop flag (" + id + "): " + client.getSessionId());
More information about the jboss-cvs-commits
mailing list