[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: ConsumerTest Hudson intermittent failure

timfox do-not-reply at jboss.com
Tue Dec 9 03:52:46 EST 2008


I think it's a very simple problem:

The test assertion is invalid:


  |  assertEquals(0, messagingService.getServer().getPostOffice().getBinding(QUEUE).getQueue().getDeliveringCount());
  | 

Delivering count is incremented in the queue *after* the message is delivered:


  |  HandleStatus status = distributionPolicy.distribute(reference);
  | 
  |       if (status == HandleStatus.HANDLED)
  |       {
  |          deliveringCount.incrementAndGet();
  |          return HandleStatus.HANDLED;
  |       }
  | 

So, depending on thread scheduling the consumer could receive the message before delivering count gets incremented, in which case it would see the value -1, because the message is actually acked and delivering count decremented *before* it's incremented.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4195242#4195242

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4195242



More information about the jboss-dev-forums mailing list