[jboss-cvs] JBoss Messaging SVN: r3366 - branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/stress.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 26 11:11:12 EST 2007


Author: timfox
Date: 2007-11-26 11:11:12 -0500 (Mon, 26 Nov 2007)
New Revision: 3366

Modified:
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
Log:
Tweak to make it run quicker


Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java	2007-11-26 15:58:09 UTC (rev 3365)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java	2007-11-26 16:11:12 UTC (rev 3366)
@@ -132,19 +132,19 @@
 	      Subscriber[] subscribers = new Subscriber[5];
    			      
 	      conn4 = cf.createConnection();
-	      subscribers[0] = new Subscriber(conn4, 3 * MSGS_PER_PUBLISHER, 500, 1000 * 60 * 15, topic, false);
+	      subscribers[0] = new Subscriber(conn4, 3 * MSGS_PER_PUBLISHER, 500, 1000 * 30, topic, false);
 	      
 	      conn5 = cf.createConnection();
-	      subscribers[1] = new Subscriber(conn5, 3 * MSGS_PER_PUBLISHER, 2000, 1000 * 60 * 15, topic, false);
+	      subscribers[1] = new Subscriber(conn5, 3 * MSGS_PER_PUBLISHER, 2000, 1000 * 30, topic, false);
 	      
 	      conn6 = cf.createConnection();
-	      subscribers[2] = new Subscriber(conn6, 3 * MSGS_PER_PUBLISHER, 700, 1000 * 60 * 15, topic, false);
+	      subscribers[2] = new Subscriber(conn6, 3 * MSGS_PER_PUBLISHER, 700, 1000 * 30, topic, false);
 	      
 	      conn7 = cf.createConnection();
-	      subscribers[3] = new Subscriber(conn7, 3 * MSGS_PER_PUBLISHER, 1500, 1000 * 60 * 15, topic, true);
+	      subscribers[3] = new Subscriber(conn7, 3 * MSGS_PER_PUBLISHER, 1500, 1000 * 30, topic, true);
 	      
 	      conn8 = cf.createConnection();
-	      subscribers[4] = new Subscriber(conn8, 3 * MSGS_PER_PUBLISHER, 1200, 1000 * 60 * 15, topic, true);
+	      subscribers[4] = new Subscriber(conn8, 3 * MSGS_PER_PUBLISHER, 1200, 1000 * 30, topic, true);
 	      
 	      Thread[] threads = new Thread[8];
 	      
@@ -327,6 +327,8 @@
    	
    	private String subname;
    	
+   	private volatile long lastMessageReceived;
+   	
    	boolean isFailed()
    	{
    		return failed;
@@ -340,7 +342,9 @@
    	   	
    	synchronized void msgReceived()
    	{   		
-   		msgsReceived++;   		
+   		msgsReceived++;   	
+   		
+   		lastMessageReceived = System.currentTimeMillis();
    	}
    	
    	synchronized int getMessagesReceived()
@@ -386,15 +390,19 @@
 		{
 			try
 			{
-				long start = System.currentTimeMillis();
-				
-				while (((System.currentTimeMillis() - start) < timeout) && msgsReceived < numMessages)
+			   boolean timedOut = false;
+			   
+				while (msgsReceived < numMessages &&
+				      !(timedOut))
 				{
 					//recycle the session
 					
 					recycleSession();
 					
 					Thread.sleep(delay);
+					
+					timedOut =
+	               lastMessageReceived != 0 && (System.currentTimeMillis() - lastMessageReceived >= timeout);
 				}
 				
 				//Delete the durable sub




More information about the jboss-cvs-commits mailing list