while (iter.hasNext())
{
Binding binding = (Binding)iter.next();
Queue queue = binding.queue;
if (queue.isRecoverable() && queue.getNodeID() == failedNodeID.intValue())
{
toRemove.add(binding);
}
}
}
Iterator iter = toRemove.iterator();
while (iter.hasNext())
{
Binding binding = (Binding)iter.next();
Condition condition = binding.condition;
Queue queue = binding.queue;
// Sanity check
if (!queue.isRecoverable())
{
throw new IllegalStateException("Found non recoverable queue " +
queue.getName() + " in map, these should have been removed!");
}
// Sanity check
if (!queue.isClustered())
{
throw new IllegalStateException("Queue " + queue.getName() + " is not clustered!");
}
//Remove from the in-memory map - no need to broadcast anything - they will get removed from other nodes in memory
//maps when the other nodes detect failure
removeBindingInMemory(binding.queue.getNodeID(), binding.queue.getName());
//Find if there is a local queue with the same name
Queue localQueue = null;
if (localNameMap != null)
{
Binding b = (Binding)localNameMap.get(queue.getName());
if (b != null)
{
localQueue = b.queue;
}
}
if (localQueue != null)
{
//need to merge the queues
log.debug(this + " has already a queue: " + queue.getName() + " queue so merging queues");
localQueue.mergeIn(queue.getChannelID(), failedNodeID.intValue());
log.debug("Merged queue");
//Delete from storage