version 1.17, 2006/10/13 18:04:50
|
version 1.18, 2007/03/16 17:16:52
|
|
|
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Consumer library directory: " + consumerDir); | PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Consumer library directory: " + consumerDir); |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Consumer configuration directory: " + consumerConfigDir); | PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Consumer configuration directory: " + consumerConfigDir); |
| |
Tracer::trace(__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL4, |
PEG_TRACE((__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL4, |
"Consumer unload enabled %d: idle timeout %d", | "Consumer unload enabled %d: idle timeout %d", |
enableConsumerUnload, | enableConsumerUnload, |
idleTimeout); |
idleTimeout)); |
| |
| |
//ATTN: Bugzilla 3765 - Uncomment when OptionManager has a reset capability | //ATTN: Bugzilla 3765 - Uncomment when OptionManager has a reset capability |
|
|
delete consumer; | delete consumer; |
} | } |
| |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Deleted all consumers"); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Deleted all consumers"); |
| |
ModuleTable::Iterator j = _modules.start(); | ModuleTable::Iterator j = _modules.start(); |
for (;j!=0;j++) | for (;j!=0;j++) |
|
|
delete module; | delete module; |
} | } |
| |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Deleted all modules"); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Deleted all modules"); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMLISTENER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMLISTENER, Logger::TRACE, |
"Not enough threads for consumer."); | "Not enough threads for consumer."); |
| |
Tracer::trace(TRC_LISTENER, Tracer::LEVEL2, |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, |
"Could not allocate thread for consumer."); | "Could not allocate thread for consumer."); |
| |
consumer->setShutdownSemaphore(0); | consumer->setShutdownSemaphore(0); |
|
|
} catch (...) | } catch (...) |
{ | { |
// Unexpected exception; do not assume that no providers are loaded | // Unexpected exception; do not assume that no providers are loaded |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "Unexpected Exception in hasActiveConsumers."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, "Unexpected Exception in hasActiveConsumers."); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; | return true; |
} | } |
|
|
} catch (...) | } catch (...) |
{ | { |
// Unexpected exception; do not assume that no providers are loaded | // Unexpected exception; do not assume that no providers are loaded |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "Unexpected Exception in hasLoadedConsumers."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, "Unexpected Exception in hasLoadedConsumers."); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; | return true; |
} | } |
|
|
| |
if (!_consumers.size()) | if (!_consumers.size()) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return; | return; |
} | } |
|
|
| |
} catch (Exception&) | } catch (Exception&) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Error unloading consumers."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Error unloading consumers."); |
} | } |
} else | } else |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
| |
if (!_consumers.size()) | if (!_consumers.size()) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return; | return; |
} | } |
|
|
| |
} catch (Exception&) | } catch (Exception&) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Error unloading consumers."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Error unloading consumers."); |
} | } |
} else | } else |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "There are no consumers to unload."); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
| |
} catch (Exception&) | } catch (Exception&) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Error unloading consumers."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Error unloading consumers."); |
} | } |
| |
} else | } else |
|
|
consumersToUnload[i]->sendShutdownSignal(); | consumersToUnload[i]->sendShutdownSignal(); |
} | } |
| |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "Sent shutdown signal to all consumers."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "Sent shutdown signal to all consumers."); |
| |
//wait for all the consumer worker threads to complete | //wait for all the consumer worker threads to complete |
//since we can only shutdown after they are all complete, it does not matter if the first, fifth, or last | //since we can only shutdown after they are all complete, it does not matter if the first, fifth, or last |
|
|
| |
} catch (TimeOut &) | } catch (TimeOut &) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "Timed out while attempting to stop consumer thread."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, "Timed out while attempting to stop consumer thread."); |
} | } |
| |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "Terminating consumer."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, "Terminating consumer."); |
| |
try | try |
{ | { |
|
|
//reset the consumer | //reset the consumer |
consumersToUnload[i]->reset(); | consumersToUnload[i]->reset(); |
| |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL3, "Consumer library successfully unloaded."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL3, "Consumer library successfully unloaded."); |
| |
} catch (Exception& e) | } catch (Exception& e) |
{ | { |
|
|
| |
} else | } else |
{ | { |
Tracer::trace(__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL3, |
PEG_TRACE((__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL3, |
"Serializing %d outstanding requests for %s", | "Serializing %d outstanding requests for %s", |
indications.size(), | indications.size(), |
(const char*)consumerName.getCString()); |
(const char*)consumerName.getCString())); |
| |
//we have to put the array of instances under a valid root element or the parser complains | //we have to put the array of instances under a valid root element or the parser complains |
XmlWriter::append(buffer, "<IRETURNVALUE>\n"); | XmlWriter::append(buffer, "<IRETURNVALUE>\n"); |
|
|
| |
XmlReader::expectEndTag(parser, "IRETURNVALUE"); | XmlReader::expectEndTag(parser, "IRETURNVALUE"); |
| |
Tracer::trace(__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL3, |
PEG_TRACE((__FILE__,__LINE__,TRC_LISTENER,Tracer::LEVEL3, |
"Consumer %s has %d outstanding indications", | "Consumer %s has %d outstanding indications", |
(const char*)consumerName.getCString(), | (const char*)consumerName.getCString(), |
indications.size()); |
indications.size())); |
| |
//delete the file | //delete the file |
FileSystem::removeFile(fileName); | FileSystem::removeFile(fileName); |
|
|
//determine if we have hit the max retry count | //determine if we have hit the max retry count |
if (event->getRetries() >= DEFAULT_MAX_RETRY_COUNT) | if (event->getRetries() >= DEFAULT_MAX_RETRY_COUNT) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, |
"Error: the maximum retry count has been exceeded. Removing the event from the queue."); | "Error: the maximum retry count has been exceeded. Removing the event from the queue."); |
| |
Logger::put( | Logger::put( |
|
|
| |
} else | } else |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "_worker_routine::placing failed indication back in queue"); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "_worker_routine::placing failed indication back in queue"); |
tmpEventQueue.insert_back(event); | tmpEventQueue.insert_back(event); |
} | } |
| |
|
|
| |
} catch (...) | } catch (...) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL2, "Error: consumeIndication() failed: Unknown exception."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL2, "Error: consumeIndication() failed: Unknown exception."); |
delete event; | delete event; |
continue; | continue; |
} //end try | } //end try |
|
|
| |
} catch (TimeOut&) | } catch (TimeOut&) |
{ | { |
PEG_TRACE_STRING(TRC_LISTENER, Tracer::LEVEL4, "_worker_routine::Time to retry any outstanding indications."); |
PEG_TRACE_CSTRING(TRC_LISTENER, Tracer::LEVEL4, "_worker_routine::Time to retry any outstanding indications."); |
| |
//signal the queue in the same way we would if we received a new indication | //signal the queue in the same way we would if we received a new indication |
//this allows the thread to fall into the queue processing code | //this allows the thread to fall into the queue processing code |