this.queues.remove(oldName);
// check if we can close or have to rename
if ( queue.tryToClose() ) {
// copy statistics
// update mbeans
((QueuesMBeanImpl)queuesMBean).sendEvent(new QueueStatusEvent(null, queue));
} else {
queue.outdate();
// readd with new name
String newName = ResourceHelper.filterName(queue.getName());
int index = 0;
while ( this.queues.containsKey(newName) ) {
newName = ResourceHelper.filterName(queue.getName()) + '$' + String.valueOf(index++);
}
this.queues.put(newName, queue);
// update mbeans
((QueuesMBeanImpl)queuesMBean).sendEvent(new QueueStatusEvent(queue, queue));
}
}