Permalink
Browse files

Handle the client ack case a little better.

  • Loading branch information...
1 parent 3b8b5d4 commit 19bd6e5740aacf543d0df4f17de69ba36465396e @chirino committed Sep 28, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/main/scala/com/github/stomp/benchmark/NonBlockingScenario.scala
@@ -443,15 +443,20 @@ class NonBlockingScenario extends Scenario {
}
+ var pending_acks = 0
+ val max_pending_acks = 1
+
override def on_receive(msg: StompFrame) = {
if( consumer_sleep != 0 && ((consumer_counter.get()%consumer_sleep_modulo) == 0)) {
- if( !clientAck ) {
+ pending_acks += 1
+ if( !clientAck || pending_acks > max_pending_acks ) {
receive_suspend
}
queue.after(math.abs(consumer_sleep), TimeUnit.MILLISECONDS) {
- if( !clientAck ) {
+ if( !clientAck || pending_acks > max_pending_acks) {
receive_resume
}
+ pending_acks -= 1
process_message(msg)
}
} else {

0 comments on commit 19bd6e5

Please sign in to comment.