diff --git a/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java b/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java index 7328007969..1de9140370 100644 --- a/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java +++ b/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java @@ -51,7 +51,8 @@ public class MessageIdList extends Assert implements MessageListener { private boolean verbose; private MessageListener parent; private long maximumDuration = 15000L; - + private long processingDelay=0; + private CountDownLatch countDownLatch; public MessageIdList() { @@ -119,6 +120,12 @@ public class MessageIdList extends Assert implements MessageListener { if (parent != null) { parent.onMessage(message); } + if( processingDelay > 0 ) { + try { + Thread.sleep(processingDelay); + } catch (InterruptedException e) { + } + } } public int getMessageCount() { @@ -241,4 +248,24 @@ public class MessageIdList extends Assert implements MessageListener { 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; + } + }