Author: clebert.suconic(a)jboss.com
Date: 2010-09-02 23:36:41 -0400 (Thu, 02 Sep 2010)
New Revision: 9637
Modified:
branches/Branch_2_1/examples/soak/tx-restarts/src/org/hornetq/jms/example/Receiver.java
Log:
tweak
Modified:
branches/Branch_2_1/examples/soak/tx-restarts/src/org/hornetq/jms/example/Receiver.java
===================================================================
---
branches/Branch_2_1/examples/soak/tx-restarts/src/org/hornetq/jms/example/Receiver.java 2010-09-03
03:15:25 UTC (rev 9636)
+++
branches/Branch_2_1/examples/soak/tx-restarts/src/org/hornetq/jms/example/Receiver.java 2010-09-03
03:36:41 UTC (rev 9637)
@@ -38,6 +38,8 @@
private final Semaphore sem = new Semaphore(0);
+ private final Semaphore max = new Semaphore(10000);
+
private final String queueJNDI;
protected volatile long msgs = 0;
@@ -75,6 +77,7 @@
{
break;
}
+ max.release();
Message msg = cons.receive(5000);
if (msg == null)
{
@@ -148,6 +151,14 @@
public void messageProduced(int pendingMsgs2)
{
sem.release(pendingMsgs2);
+ try
+ {
+ max.acquire(pendingMsgs2);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
}
// Package protected ---------------------------------------------