[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Paging discussion:

clebert.suconic@jboss.com do-not-reply at jboss.com
Wed Aug 20 10:39:53 EDT 2008


"timfox" wrote : "clebert.suconic at jboss.com" wrote : 
  |   | I would need a parameter on increment / decrement to determine if it is durable or not. The ServerMessage don't know about that
  | 
  | Yes, I'd add a parameter. Otherwise for durable messages you going to have to call two methods - incrementDurable() and incrementPaging() or whatever you called it.

increment and decrement are atomic operations.
If I add a parameter I would be dealing with two counters, and those methods would need to become void.

This is the current ack code on my Branch. Notice that those counters are called atomically... so I really need two methods:

   private void doAck(final MessageReference ref) throws Exception
  |    {
  |       ServerMessage message = ref.getMessage();
  | 
  |       Queue queue = ref.getQueue();
  |       
  |       if (message.decrementRefCount() == 0)
  |       {
  |          postOffice.messageDone(message);
  |       }
  |       
  |       if (message.isDurable() && queue.isDurable())
  |       {
  |          int count = message.decrementDurableRefCount();
  | 
  |          if (count == 0)
  |          {
  |             storageManager.storeDelete(message.getMessageID());
  |          }
  |          else
  |          {
  |             storageManager.storeAcknowledge(queue.getPersistenceID(), message.getMessageID());
  |          }
  |       }
  | 
  |       queue.referenceAcknowledged(ref);
  |    }
  | 


Another option would be to add two arguments to return the two counters... such as:


increment(boolean durable, AtomicInt returnDurable, AtomicInt returnNonDurable);

But that's terrible... so I will just keep two methods.

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

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



More information about the jboss-dev-forums mailing list