/* */
/* 533 */ Map ackMap = new HashMap();
/* */
/* 535 */ for (Iterator iter = deliveryRecoveryInfos.iterator(); iter.hasNext(); )
/* */ {
/* 537 */ DeliveryRecovery deliveryInfo = (DeliveryRecovery)iter.next();
/* */
/* 539 */ String queueName = deliveryInfo.getQueueName();
/* */
/* 541 */ List acks = (List)ackMap.get(queueName);
/* */
/* 543 */ if (acks == null)
/* */ {
/* 545 */ acks = new ArrayList();
/* */
/* 547 */ ackMap.put(queueName, acks);
/* */ }
/* */
/* 550 */ acks.add(deliveryInfo);
/* */ }
/* */
/* 553 */ Iterator iter = ackMap.entrySet().iterator();
/* */
/* 555 */ while (iter.hasNext())
/* */ {
/* 557 */ Map.Entry entry = (Map.Entry)iter.next();
/* */
/* 559 */ String queueName = (String)entry.getKey();
/* */
/* 563 */ Binding binding = this.postOffice.getBindingForQueueName(queueName);
/* */
/* 565 */ Queue queue = binding.queue;
/* */
/* 567 */ if (queue == null)
/* */ {
/* 569 */ throw new IllegalStateException("Cannot find queue with queue name: " + queueName);
/* */ }
/* */
/* 572 */ List acks = (List)entry.getValue();
/* */
/* 574 */ List ids = new ArrayList(acks.size());
/* */
/* 576 */ for (Iterator iter2 = acks.iterator(); iter2.hasNext(); )
/* */ {
/* 578 */ DeliveryRecovery info = (DeliveryRecovery)iter2.next();
/* */
/* 580 */ ids.add(new Long(info.getMessageID()));
/* */ }
/* */
/* 583 */ JMSCondition cond = (JMSCondition)binding.condition;
/* */
/* 585 */ ManagedDestination dest = this.sp.getDestinationManager().getDestination(cond.getName(), cond.isQueue());
/* */
/* 588 */ if (dest == null)
/* */ {
/* 590 */ throw new IllegalStateException("Cannot find managed destination with name " + cond.getName() + " isQueue" + cond.isQueue());
/* */ }
/* */
/* 594 */ Queue dlqToUse = dest.getDLQ() == null ? this.defaultDLQ : dest.getDLQ();
/* */
/* 597 */ Queue expiryQueueToUse = dest.getExpiryQueue() == null ? this.defaultExpiryQueue : dest.getExpiryQueue();
/* */
/* 600 */ int maxDeliveryAttemptsToUse = dest.getMaxDeliveryAttempts() == -1 ? this.defaultMaxDeliveryAttempts : dest.getMaxDeliveryAttempts();
/* */
/* 603 */ List dels = queue.recoverDeliveries(ids);
/* */
/* 605 */ Iterator iter2 = dels.iterator();
/* */
/* 607 */ Iterator iter3 = acks.iterator();
/* */
/* 609 */ while (iter2.hasNext())
/* */ {
/* 611 */ Delivery del = (Delivery)iter2.next();
/* */
/* 613 */ DeliveryRecovery info = (DeliveryRecovery)iter3.next();
/* */
/* 615 */ long deliveryId = info.getDeliveryID();
/* */
/* 617 */ maxDeliveryId = Math.max(maxDeliveryId, deliveryId);
/* */
/* 619 */ if (this.trace) log.trace(this + " Recovered delivery " + deliveryId + ", " + del);
/* */