[jboss-cvs] JBossAS SVN: r58472 - trunk/testsuite/src/main/org/jboss/test/security/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 16 17:32:14 EST 2006


Author: scott.stark at jboss.org
Date: 2006-11-16 17:32:13 -0500 (Thu, 16 Nov 2006)
New Revision: 58472

Modified:
   trunk/testsuite/src/main/org/jboss/test/security/test/SRPUnitTestCase.java
Log:
Avoid hangs due to a client failure.

Modified: trunk/testsuite/src/main/org/jboss/test/security/test/SRPUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/test/SRPUnitTestCase.java	2006-11-16 21:44:29 UTC (rev 58471)
+++ trunk/testsuite/src/main/org/jboss/test/security/test/SRPUnitTestCase.java	2006-11-16 22:32:13 UTC (rev 58472)
@@ -121,8 +121,10 @@
       UserThread ut1 = new UserThread(log);
 
       Thread t0 = new Thread(ut0, "UserThread#0");
+      t0.setDaemon(true);
       t0.start();
       Thread t1 = new Thread(ut1, "UserThread#1");
+      t1.setDaemon(true);
       t1.start();
 
       // Release the ut0 thread and wait for it to finish the first ejb call
@@ -130,29 +132,41 @@
       {
          ut0.semaphore = true;
          ut0.notify();
-         ut0.wait();
+         log.info("waiting on ut0 #1");
+         ut0.wait(5000);
       }
+      log.info("released ut0 #1");
       // Release the ut1 thread and wait for it to finish the first ejb call
       synchronized( ut1 )
       {
          ut1.semaphore = true;
          ut1.notify();
-         ut1.wait();
+         log.info("waiting on ut1 #1");
+         ut1.wait(5000);
       }
+      log.info("released ut1 #1");
+      assertTrue("UserThread0.ex == null", ut0.ex == null);
+         
       // Release the ut1 thread and wait for it to finish the second ejb call
       synchronized( ut1 )
       {
          ut1.semaphore = true;
          ut1.notify();
-         ut1.wait();
+         log.info("waiting on ut1 #2");
+         ut1.wait(5000);
       }
+      log.info("released ut1 #2");
+      assertTrue("UserThread1.ex == null", ut1.ex == null);
+
       // Release the ut0 thread and wait for it to finish the second ejb call
       synchronized( ut0 )
       {
          ut0.semaphore = true;
          ut0.notify();
-         ut0.wait();
+         log.info("waiting on ut0 #2");
+         ut0.wait(5000);
       }
+      log.info("released ut0 #2");
 
       t0.join();
       log.debug("UserThread0.ex", ut0.ex);
@@ -226,6 +240,12 @@
          this.log = log;
       }
 
+      public synchronized boolean semaphore()
+      {
+         semaphore = true;
+         return semaphore;
+      }
+
       public void run()
       {
          try
@@ -255,6 +275,7 @@
          log.debug("Enter wait");
          while( semaphore == false )
          {
+            log.info("waiting for notification");
             wait(1000);
          }
          semaphore = false;
@@ -263,13 +284,15 @@
          log.debug("Created srp.StatelessSession");
          log.debug("Bean.echo('Hello') -> "+bean.echo("Hello"));
          notifyAll();
-         log.debug("Enter wait#2");
+         log.debug("Notified all, enter wait#2");
          while( semaphore == false )
          {
+            log.info("waiting for notification");
             wait(1000);
          }
          log.debug("Notified, Bean.echo('Hello#2') -> "+bean.echo("Hello#2"));
          notifyAll();
+         log.debug("Notified all, logging out");
          lc.logout();
          log.debug("Logout");
       }




More information about the jboss-cvs-commits mailing list