* @param queueInfo The queue info
* @param topics The topics
*/
private void start(final QueueInfo queueInfo,
final Set<String> topics) {
final InternalQueueConfiguration config = queueInfo.queueConfiguration;
// get or create queue
AbstractJobQueue queue = null;
// we synchronize to avoid creating a queue which is about to be removed during cleanup
synchronized ( queuesLock ) {
queue = this.queues.get(queueInfo.queueName);
// check for reconfiguration, we really do an identity check here(!)
if ( queue != null && queue.getConfiguration() != config ) {
this.outdateQueue(queue);
// we use a new queue with the configuration
queue = null;
}
if ( queue == null ) {
if ( config.getType() == QueueConfiguration.Type.ORDERED
|| config.getType() == QueueConfiguration.Type.TOPIC_ROUND_ROBIN ) {
queue = new OrderedJobQueue(queueInfo.queueName, config, queueServices, topics);
} else if ( config.getType() == QueueConfiguration.Type.UNORDERED ) {
queue = new ParallelJobQueue(queueInfo.queueName, config, queueServices, topics);
}
// this is just a sanity check, actually we always have a queue instance here
if ( queue != null ) {
queues.put(queueInfo.queueName, queue);