synchronized (_queueRegistry)
{
if(_queueRegistry.getQueue(queueName) != null)
{
throw new QueueExistsException("Queue with name " + queueName + " already exists", _queueRegistry.getQueue(queueName));
}
if(id == null)
{
id = UUIDGenerator.generateExchangeUUID(queueName, getName());
while(_queueRegistry.getQueue(id) != null)
{
id = UUID.randomUUID();
}
}
else if(_queueRegistry.getQueue(id) != null)
{
throw new QueueExistsException("Queue with id " + id + " already exists", _queueRegistry.getQueue(queueName));
}
return _queueFactory.createQueue(id, queueName, durable, owner, autoDelete, exclusive, deleteOnNoConsumer,
arguments);
}