<div dir="ltr">I would like to use the example code provided in�<a href="http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/">http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/</a><div>
<br></div><div>I'm trying to understand the below snippet:</div><div><br></div><div><pre style="color:rgb(85,85,85);font-size:13px;line-height:18px">for (long i = 0; i < MSG_COUNT; ++i) {
     unconfirmedSet.add(ch.getNextPublishSeqNo());
     ch.basicPublish("", QUEUE_NAME, MessageProperties.PERSISTENT_BASIC,
                       "nop".getBytes());
 }
while (unconfirmedSet.size() > 0)
     Thread.sleep(10);</pre><pre style="color:rgb(85,85,85);font-size:13px;line-height:18px">As stated, "<span style="font-family:Verdana,sans-serif">the producer waits for all the messages to be confirmed."  Assuming that's the above code.  Is the "while" logic safe?  What happens when the "unconfirmedSet.size" is always greater than 0?  Also, the "MSG_COUNT" if set to 10000, does the for loop will always loop 10000 times even though there might only be say 10 messages?</span></pre>
</div></div>