version 1.31, 2008/12/16 18:56:42
|
version 1.31.10.2, 2011/08/10 04:59:40
|
|
|
"Consumer not found in cache, creating %s", | "Consumer not found in cache, creating %s", |
(const char*)consumerName.getCString())); | (const char*)consumerName.getCString())); |
consumer = new DynamicConsumer(consumerName); | consumer = new DynamicConsumer(consumerName); |
//ATTN: The above is a memory leak if _initConsumer throws an exception |
|
//need to delete it in that case |
|
} | } |
| |
if (!cached) | if (!cached) |
{ | { |
|
AutoPtr<DynamicConsumer> destroyer(consumer); |
_initConsumer(consumerName, consumer); | _initConsumer(consumerName, consumer); |
|
destroyer.release(); |
| |
if (!entryExists) | if (!entryExists) |
{ | { |
|
|
| |
consumer->initialize(); | consumer->initialize(); |
| |
//ATTN: need to change this |
Semaphore* semaphore = consumer->getShutdownSemaphore(); |
Semaphore* semaphore = new Semaphore(0); //blocking |
|
|
|
consumer->setShutdownSemaphore(semaphore); |
|
| |
//start the worker thread | //start the worker thread |
if (_thread_pool->allocate_and_awaken(consumer, | if (_thread_pool->allocate_and_awaken(consumer, |
|
|
Tracer::LEVEL1, | Tracer::LEVEL1, |
"Could not allocate thread for consumer."); | "Could not allocate thread for consumer."); |
| |
consumer->setShutdownSemaphore(0); |
|
delete semaphore; |
|
throw Exception( | throw Exception( |
MessageLoaderParms( | MessageLoaderParms( |
"DynListener.ConsumerManager.CANNOT_ALLOCATE_THREAD", | "DynListener.ConsumerManager.CANNOT_ALLOCATE_THREAD", |