You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/07/27 18:02:05 UTC

svn commit: r560294 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java

Author: chirino
Date: Fri Jul 27 09:02:04 2007
New Revision: 560294

URL: http://svn.apache.org/viewvc?view=rev&rev=560294
Log:
Added a handy processingDelay option to the MessageIdList so that a test case and simulate a slow consumer

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java?view=diff&rev=560294&r1=560293&r2=560294
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java Fri Jul 27 09:02:04 2007
@@ -51,7 +51,8 @@
     private boolean verbose;
     private MessageListener parent;
     private long maximumDuration = 15000L;
-
+    private long processingDelay=0;
+    
 	private CountDownLatch countDownLatch;
 
     public MessageIdList() {
@@ -119,6 +120,12 @@
         if (parent != null) {
             parent.onMessage(message);
         }
+        if( processingDelay > 0 ) {
+        	try {
+				Thread.sleep(processingDelay);
+			} catch (InterruptedException e) {
+			}
+        }
     }
 
     public int getMessageCount() {
@@ -239,6 +246,26 @@
 
 	public void setCountDownLatch(CountDownLatch countDownLatch) {
 		this.countDownLatch = countDownLatch;
+	}
+
+	/**
+	 * Gets the amount of time the message listener will spend sleeping to
+	 * simulate a processing delay.
+	 * 
+	 * @return
+	 */
+	public long getProcessingDelay() {
+		return processingDelay;
+	}
+
+	/**
+	 * Sets the amount of time the message listener will spend sleeping to
+	 * simulate a processing delay.
+	 * 
+	 * @param processingDelay
+	 */
+	public void setProcessingDelay(long processingDelay) {
+		this.processingDelay = processingDelay;
 	}
 
 }