version 1.38, 2004/05/17 23:42:58
|
version 1.78, 2006/04/18 19:08:44
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) | // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
// Adrian Schuur, IBM (schuur@de.ibm.com) | // Adrian Schuur, IBM (schuur@de.ibm.com) |
// Amit K Arora (amita@in.ibm.com) for PEP-101 | // Amit K Arora (amita@in.ibm.com) for PEP-101 |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Seema Gupta (gseema@in.ibm.com for PEP135) |
|
// Jim Wunderlich (Jim_Wunderlich@prodigy.net) |
|
// Aruran, IBM (ashanmug@in.ibm.com)for Bug# 3881 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "ProviderManagerService.h" | #include "ProviderManagerService.h" |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
#include <Pegasus/Common/PegasusVersion.h> |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
|
#include <Pegasus/Common/Thread.h> |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/AutoPtr.h> | #include <Pegasus/Common/AutoPtr.h> |
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
#include <Pegasus/Common/Constants.h> |
| |
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
| |
#include <Pegasus/ProviderManager2/ProviderManagerModule.h> |
#include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> |
#include <Pegasus/ProviderManager2/ProviderManager.h> |
#include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h> |
#include <Pegasus/ProviderManager2/ProviderType.h> |
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
#include <Pegasus/ProviderManager2/ProviderName.h> |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
static const Uint16 _MODULE_OK = 2; |
|
static const Uint16 _MODULE_STOPPING = 9; |
|
static const Uint16 _MODULE_STOPPED = 10; |
|
|
|
// BEGIN TEMP SECTION |
|
class ProviderManagerContainer |
|
{ |
|
public: |
|
ProviderManagerContainer(void) : _manager(0) |
|
{ |
|
} |
|
|
|
ProviderManagerContainer(const ProviderManagerContainer & container) : _manager(0) |
|
{ |
|
*this = container; |
|
} |
|
|
|
ProviderManagerContainer(const String & physicalName, const String & logicalName, const String & interfaceName) : _manager(0) |
|
{ |
|
_physicalName=ProviderManager::_resolvePhysicalName(physicalName); |
|
|
|
_logicalName = logicalName; |
|
|
|
_interfaceName = interfaceName; |
|
|
|
_module = ProviderManagerModule(_physicalName); |
|
|
|
_module.load(); |
|
|
|
_manager = _module.getProviderManager(_logicalName); |
|
|
|
PEGASUS_ASSERT(_manager != 0); |
|
} |
|
|
|
~ProviderManagerContainer(void) |
|
{ |
|
_module.unload(); |
|
} |
|
|
|
ProviderManagerContainer & operator=(const ProviderManagerContainer & container) |
|
{ |
|
if(this == &container) |
|
{ |
|
return(*this); |
|
} |
|
|
|
_logicalName = container._logicalName; |
|
_physicalName = container._physicalName; |
|
_interfaceName = container._interfaceName; |
|
|
|
_module = container._module; |
|
_manager = container._manager; |
|
|
|
return(*this); |
|
} |
|
|
|
ProviderManager *getProviderManager(void) |
|
{ |
|
return _manager; |
|
} |
|
|
|
const String & getPhysicalName(void) const |
|
{ |
|
return(_physicalName); |
|
} |
|
|
|
const String & getLogicalName(void) const |
|
{ |
|
return(_logicalName); |
|
} |
|
|
|
const String & getInterfaceName(void) const |
|
{ |
|
return(_interfaceName); |
|
} |
|
|
|
private: |
|
String _physicalName; |
|
String _logicalName; |
|
String _interfaceName; |
|
|
|
ProviderManagerModule _module; |
|
ProviderManager * _manager; |
|
|
|
}; |
|
|
|
static Array<ProviderManagerContainer*> _providerManagers; |
|
// END TEMP SECTION |
|
|
|
inline Boolean _isSupportedRequestType(const Message * message) | inline Boolean _isSupportedRequestType(const Message * message) |
{ | { |
// ATTN: needs implementation | // ATTN: needs implementation |
|
|
} | } |
| |
ProviderManagerService* ProviderManagerService::providerManagerService=NULL; | ProviderManagerService* ProviderManagerService::providerManagerService=NULL; |
CIMRepository* ProviderManagerService::_repository=NULL; |
Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; |
| |
ProviderManagerService::ProviderManagerService(void) | ProviderManagerService::ProviderManagerService(void) |
: MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) | : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP) |
|
|
| |
_providerRegistrationManager = providerRegistrationManager; | _providerRegistrationManager = providerRegistrationManager; |
| |
// ATTN: this section is a temporary solution to populate the list of enabled |
_unloadIdleProvidersBusy = 0; |
// provider managers for a given distribution. it includes another temporary |
|
// solution for converting a generic file name into a file name useable by |
|
// each platform. |
|
|
|
// BEGIN TEMP SECTION |
|
//#if defined(PEGASUS_OS_OS400) |
|
//_providerManagers.append(ProviderManagerContainer("QSYS/??????????", "INTERNAL", "INTERNAL")); |
|
//#else |
|
//_providerManager.append(ProviderManagerContainer("InternalProviderManager", "DEFAULT", "INTERNAL")); |
|
//#endif |
|
|
|
#if defined(ENABLE_DEFAULT_PROVIDER_MANAGER) |
|
#if defined(PEGASUS_OS_OS400) |
|
_providerManagers.append( |
|
new ProviderManagerContainer("QSYS/QYCMDFTPVM", "DEFAULT", "C++Default")); |
|
#else |
|
_providerManagers.append( |
|
new ProviderManagerContainer("DefaultProviderManager", "DEFAULT", "C++Default")); |
|
#endif |
|
#endif |
|
| |
#if defined(ENABLE_CMPI_PROVIDER_MANAGER) |
_basicProviderManagerRouter = 0; |
#if defined(PEGASUS_OS_OS400) |
_oopProviderManagerRouter = 0; |
_providerManagers.append( |
|
new ProviderManagerContainer("QSYS/QYCMCMPIPM", "CMPI", "CMPI")); |
// Determine which ProviderManagerRouter(s) to use |
#else |
|
_providerManagers.append( |
|
new ProviderManagerContainer("CMPIProviderManager", "CMPI", "CMPI")); |
|
#endif |
|
#endif |
|
| |
#if defined(ENABLE_JMPI_PROVIDER_MANAGER) |
ConfigManager* configManager = ConfigManager::getInstance(); |
#if defined(PEGASUS_OS_OS400) |
Boolean forceProviderProcesses = String::equal( |
_providerManagers.append( |
configManager->getCurrentValue("forceProviderProcesses"), "true"); |
new ProviderManagerContainer("QSYS/QYCMJMPIPM", "JMPI", "JMPI")); |
|
|
#ifdef PEGASUS_DISABLE_PROV_USERCTXT |
|
if (forceProviderProcesses) |
|
{ |
|
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
|
indicationCallback, responseChunkCallback); |
|
} |
|
else |
|
{ |
|
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
|
indicationCallback, responseChunkCallback); |
|
} |
#else | #else |
_providerManagers.append( |
_oopProviderManagerRouter = new OOPProviderManagerRouter( |
new ProviderManagerContainer("JMPIProviderManager", "JMPI", "JMPI")); |
indicationCallback, responseChunkCallback); |
#endif |
|
#endif |
|
| |
// END TEMP SECTION |
if (!forceProviderProcesses) |
|
{ |
|
_basicProviderManagerRouter = new BasicProviderManagerRouter( |
|
indicationCallback, responseChunkCallback); |
|
} |
|
#endif |
} | } |
| |
ProviderManagerService::~ProviderManagerService(void) | ProviderManagerService::~ProviderManagerService(void) |
{ | { |
|
delete _basicProviderManagerRouter; |
|
delete _oopProviderManagerRouter; |
providerManagerService=NULL; | providerManagerService=NULL; |
} | } |
| |
|
|
request->op->processing(); | request->op->processing(); |
| |
_incomingQueue.enqueue(request->op); | _incomingQueue.enqueue(request->op); |
|
ThreadStatus rtn = PEGASUS_THREAD_OK; |
while (!_thread_pool->allocate_and_awaken( |
while (( rtn =_thread_pool->allocate_and_awaken( |
(void *)this, ProviderManagerService::handleCimOperation)) |
(void *)this, ProviderManagerService::handleCimOperation)) != PEGASUS_THREAD_OK) |
{ | { |
|
if (rtn==PEGASUS_THREAD_INSUFFICIENT_RESOURCES) |
pegasus_yield(); | pegasus_yield(); |
|
else |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"Not enough threads to service provider manager." ); |
|
|
|
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Could not allocate thread for %s.", |
|
getQueueName()); |
|
break; |
|
} |
} | } |
} | } |
else | else |
|
|
return; | return; |
} | } |
| |
|
// Note: This method should not throw an exception. It is used as a thread |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleCimOperation(void * arg) throw() |
// entry point, and any exceptions thrown are ignored. |
|
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
|
ProviderManagerService::handleCimOperation(void* arg) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimOperation"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::handleCimOperation"); |
| |
if(arg == 0) |
PEGASUS_ASSERT(arg != 0); |
{ |
|
// thread started with invalid argument. |
|
return(PEGASUS_THREAD_RETURN(1)); |
|
} |
|
| |
// get the service from argument | // get the service from argument |
ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg); |
ProviderManagerService* service = |
|
reinterpret_cast<ProviderManagerService *>(arg); |
|
PEGASUS_ASSERT(service != 0); |
| |
|
try |
|
{ |
if(service->_incomingQueue.size() == 0) | if(service->_incomingQueue.size() == 0) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"ProviderManagerService::handleCimOperation() called with no op node in queue" ); |
"ProviderManagerService::handleCimOperation() called with no " |
|
"op node in queue"); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
// thread started with no message in queue. |
|
return(PEGASUS_THREAD_RETURN(1)); | return(PEGASUS_THREAD_RETURN(1)); |
} | } |
| |
|
|
| |
if((op == 0) || (op->_request.count() == 0)) | if((op == 0) || (op->_request.count() == 0)) |
{ | { |
|
// ATTN: This may dereference a null pointer! |
MessageQueue * queue = MessageQueue::lookup(op->_source_queue); | MessageQueue * queue = MessageQueue::lookup(op->_source_queue); |
| |
PEGASUS_ASSERT(queue != 0); | PEGASUS_ASSERT(queue != 0); |
|
|
return(PEGASUS_THREAD_RETURN(1)); | return(PEGASUS_THREAD_RETURN(1)); |
} | } |
| |
AsyncRequest * request = static_cast<AsyncRequest *>(op->_request.next(0)); |
AsyncRequest* request = |
|
static_cast<AsyncRequest*>(op->_request.next(0)); |
| |
if((request == 0) || (request->getType() != async_messages::ASYNC_LEGACY_OP_START)) |
if ((request == 0) || |
|
(request->getType() != async_messages::ASYNC_LEGACY_OP_START)) |
{ | { |
// reply with NAK | // reply with NAK |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
return(PEGASUS_THREAD_RETURN(0)); | return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
try |
Message* legacy = |
{ |
static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
Message * legacy = static_cast<AsyncLegacyOperationStart *>(request)->get_action(); |
|
| |
if(_isSupportedRequestType(legacy)) | if(_isSupportedRequestType(legacy)) |
{ | { |
|
|
| |
if(msg != 0) | if(msg != 0) |
{ | { |
AcceptLanguages * langs = new AcceptLanguages(msg->acceptLanguages); |
AcceptLanguageList* langs = new AcceptLanguageList( |
|
((AcceptLanguageListContainer)msg->operationContext.get( |
|
AcceptLanguageListContainer::NAME)).getLanguages()); |
Thread::setLanguages(langs); | Thread::setLanguages(langs); |
} | } |
else | else |
|
|
service->handleCimRequest(op, legacy); | service->handleCimRequest(op, legacy); |
} | } |
} | } |
|
catch (const Exception& e) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Unexpected exception in handleCimOperation: " + e.getMessage()); |
|
} |
catch(...) | catch(...) |
{ | { |
// ATTN: log error |
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Unexpected exception in handleCimOperation."); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
return(PEGASUS_THREAD_RETURN(0)); | return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
void ProviderManagerService::handleCimRequest(AsyncOpNode * op, Message * message) |
void ProviderManagerService::handleCimRequest( |
|
AsyncOpNode * op, |
|
Message * message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::handleCimRequest"); |
| |
CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message); | CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message); |
PEGASUS_ASSERT(request != 0); | PEGASUS_ASSERT(request != 0); |
|
|
PEGASUS_ASSERT(async != 0); | PEGASUS_ASSERT(async != 0); |
| |
Message * response = 0; | Message * response = 0; |
|
Boolean consumerLookupFailed = false; |
|
|
|
if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) |
|
{ |
|
// |
|
// Get a ProviderIdContainer for ExportIndicationRequestMessage. |
|
// Note: This can be removed when the CIMExportRequestDispatcher |
|
// is updated to add the ProviderIdContainer to the message. |
|
// |
|
CIMInstance providerModule; |
|
CIMInstance provider; |
|
const CIMExportIndicationRequestMessage* expRequest = |
|
dynamic_cast<const CIMExportIndicationRequestMessage*>(request); |
|
if (_providerRegistrationManager->lookupIndicationConsumer( |
|
expRequest->destinationPath, provider, providerModule)) |
|
{ |
|
request->operationContext.insert( |
|
ProviderIdContainer(providerModule, provider)); |
|
} |
|
else |
|
{ |
|
consumerLookupFailed = true; |
|
} |
|
} |
|
|
|
if (consumerLookupFailed) |
|
{ |
|
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
response = cimResponse; |
|
} |
|
else if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
|
(dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) || |
|
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) || |
|
(request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE)) |
|
{ |
|
// Handle CIMOperationRequestMessage, CIMExportIndicationRequestMessage, |
|
// CIMIndicationRequestMessage, and CIMInitializeProviderRequestMessage. |
|
// (These should be blocked when the provider module is disabled.) |
|
|
|
// |
|
// Get the provider module instance to check for a disabled module |
|
// |
|
CIMInstance providerModule; |
|
|
|
// The provider ID container is added to the OperationContext |
|
// by the CIMOperationRequestDispatcher for all CIM operation |
|
// requests to providers, so it does not need to be added again. |
|
// CIMInitializeProviderRequestMessage also has a provider ID |
|
// container. |
|
ProviderIdContainer pidc = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
|
|
|
// |
|
// Check if the target provider is disabled |
|
// |
|
Boolean moduleDisabled = false; |
|
Uint32 pos = providerModule.findProperty(CIMName("OperationalStatus")); |
|
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
Array<Uint16> operationalStatus; |
|
providerModule.getProperty(pos).getValue().get(operationalStatus); |
|
|
|
for(Uint32 i = 0; i < operationalStatus.size(); i++) |
|
{ |
|
if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) || |
|
(operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)) |
|
{ |
|
moduleDisabled = true; |
|
break; |
|
} |
|
} |
| |
if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
if (moduleDisabled) |
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)) |
|
{ | { |
// Handle CIMOperationRequestMessage and |
// |
// CIMExportIndicationRequestMessage |
// Send a "provider blocked" response |
|
// |
|
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_ACCESS_DENIED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService.PROVIDER_BLOCKED", |
|
"provider blocked.")); |
|
response = cimResponse; |
| |
// Add provider information to OperationContext for the ProviderManager |
STAT_COPYDISPATCHER |
ProviderIdContainer pidc = _getProviderIdContainer(request); |
} |
request->operationContext.insert(pidc); |
else |
|
{ |
// Retrieve the provider interface type |
// |
String interfaceType; |
// Forward the request to the appropriate ProviderManagerRouter |
CIMValue itValue = pidc.getModule().getProperty( |
// |
pidc.getModule().findProperty("InterfaceType")).getValue(); |
response = _processMessage(request); |
itValue.get(interfaceType); |
} |
|
|
// Forward the request to the appropriate ProviderManager |
|
ProviderManager* pm = _lookupProviderManager(interfaceType); |
|
response = pm->processMessage(request); |
|
} |
|
else if (dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) |
|
{ |
|
// Handle CIMIndicationRequestMessage |
|
CIMIndicationRequestMessage* indReq = |
|
dynamic_cast<CIMIndicationRequestMessage*>(request); |
|
|
|
// Get the InterfaceType property from the provider module instance |
|
String interfaceType; |
|
CIMValue itValue = indReq->providerModule.getProperty( |
|
indReq->providerModule.findProperty("InterfaceType")).getValue(); |
|
itValue.get(interfaceType); |
|
|
|
// Forward the request to the appropriate ProviderManager |
|
ProviderManager* pm = _lookupProviderManager(interfaceType); |
|
response = pm->processMessage(request); |
|
} | } |
else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) | else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
{ | { |
|
|
| |
try | try |
{ | { |
// Get the InterfaceType property from the provider module instance |
// Forward the request to the ProviderManager |
String interfaceType; |
response = _processMessage(request); |
CIMValue itValue = emReq->providerModule.getProperty( |
|
emReq->providerModule.findProperty("InterfaceType")).getValue(); |
|
itValue.get(interfaceType); |
|
|
|
// Forward the request to the appropriate ProviderManager |
|
// ATTN: Why is this sent to a provider manager at all? |
|
ProviderManager* pm = _lookupProviderManager(interfaceType); |
|
response = pm->processMessage(request); |
|
| |
// If successful, update provider module status to OK | // If successful, update provider module status to OK |
// ATTN: Use CIMEnableModuleResponseMessage operationalStatus? | // ATTN: Use CIMEnableModuleResponseMessage operationalStatus? |
|
|
if (emResp->cimException.getCode() == CIM_ERR_SUCCESS) | if (emResp->cimException.getCode() == CIM_ERR_SUCCESS) |
{ | { |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_STOPPED, _MODULE_OK); |
providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPED, |
|
CIM_MSE_OPSTATUS_VALUE_OK); |
} | } |
} | } |
catch (Exception& e) | catch (Exception& e) |
|
|
.getValue(); | .getValue(); |
itValue.get(operationalStatus); | itValue.get(operationalStatus); |
| |
if (response != 0) |
|
{ |
|
delete response; | delete response; |
} |
|
| |
response = new CIMEnableModuleResponseMessage( | response = new CIMEnableModuleResponseMessage( |
request->messageId, | request->messageId, |
|
|
| |
try | try |
{ | { |
// Get the InterfaceType property from the provider module instance |
|
String interfaceType; |
|
CIMValue itValue = dmReq->providerModule.getProperty( |
|
dmReq->providerModule.findProperty("InterfaceType")).getValue(); |
|
itValue.get(interfaceType); |
|
|
|
// Change module status from OK to STOPPING | // Change module status from OK to STOPPING |
if (updateModuleStatus) | if (updateModuleStatus) |
{ | { |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_OK, _MODULE_STOPPING); |
providerModule, CIM_MSE_OPSTATUS_VALUE_OK, |
|
CIM_MSE_OPSTATUS_VALUE_STOPPING); |
} | } |
| |
// Forward the request to the appropriate ProviderManager |
// Forward the request to the ProviderManager |
// ATTN: Why is this sent to a provider manager at all? |
response = _processMessage(request); |
ProviderManager* pm = _lookupProviderManager(interfaceType); |
|
response = pm->processMessage(request); |
|
| |
// Update provider module status based on success or failure | // Update provider module status based on success or failure |
if (updateModuleStatus) | if (updateModuleStatus) |
|
|
{ | { |
// Disable operation failed. Module not stopped. | // Disable operation failed. Module not stopped. |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_STOPPING, _MODULE_OK); |
providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING, |
|
CIM_MSE_OPSTATUS_VALUE_OK); |
} | } |
else | else |
{ | { |
|
|
// depending on whether there are outstanding requests. | // depending on whether there are outstanding requests. |
// Use last operationalStatus entry. | // Use last operationalStatus entry. |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_STOPPING, |
providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING, |
dmResp->operationalStatus[ | dmResp->operationalStatus[ |
dmResp->operationalStatus.size()-1]); | dmResp->operationalStatus.size()-1]); |
} | } |
|
|
.getValue(); | .getValue(); |
itValue.get(operationalStatus); | itValue.get(operationalStatus); |
| |
if (response != 0) |
|
{ |
|
delete response; | delete response; |
} |
|
| |
response = new CIMDisableModuleResponseMessage( | response = new CIMDisableModuleResponseMessage( |
request->messageId, | request->messageId, |
|
|
operationalStatus); | operationalStatus); |
} | } |
} | } |
else if (request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) |
|
{ |
|
// Handle CIMStopAllProvidersRequestMessage |
|
// Send CIMStopAllProvidersRequestMessage to all ProviderManagers |
|
for (Uint32 i = 0, n = _providerManagers.size(); i < n; i++) |
|
{ |
|
ProviderManagerContainer* pmc=_providerManagers[i]; |
|
Message* resp = pmc->getProviderManager()->processMessage(request); |
|
if (resp) |
|
{ |
|
response = resp; |
|
} |
|
} |
|
} |
|
else | else |
{ | { |
// ERROR: Unrecognized message type. |
response = _processMessage(request); |
PEGASUS_ASSERT(0); |
|
CIMResponseMessage* resp = new CIMResponseMessage( |
|
0, request->messageId, CIMException(), |
|
request->queueIds.copyAndPop()); |
|
resp->synch_response(request); |
|
OperationResponseHandler handler(request, resp); |
|
handler.setStatus(CIM_ERR_FAILED, "Unknown message type."); |
|
response = resp; |
|
} | } |
| |
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
AsyncLegacyOperationResult * async_result = | AsyncLegacyOperationResult * async_result = |
new AsyncLegacyOperationResult( | new AsyncLegacyOperationResult( |
async->getKey(), | async->getKey(), |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
// ATTN: May need to add interfaceVersion parameter to further constrain lookup |
void ProviderManagerService::responseChunkCallback( |
ProviderManager* ProviderManagerService::_lookupProviderManager( |
CIMRequestMessage* request, |
const String& interfaceType) |
CIMResponseMessage* response) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::_lookupProviderManager"); |
"ProviderManagerService::responseChunkCallback"); |
| |
// find provider manager for specified provider interface type |
try |
for(Uint32 i = 0, n = _providerManagers.size(); i < n; i++) |
|
{ | { |
if (interfaceType == _providerManagers[i]->getInterfaceName()) |
// only incomplete messages are processed because the caller ends up |
|
// sending the complete() stage |
|
PEGASUS_ASSERT(response->isComplete() == false); |
|
|
|
AsyncLegacyOperationStart *requestAsync = |
|
dynamic_cast<AsyncLegacyOperationStart *>(request->_async); |
|
PEGASUS_ASSERT(requestAsync); |
|
AsyncOpNode *op = requestAsync->op; |
|
PEGASUS_ASSERT(op); |
|
PEGASUS_ASSERT(!response->_async); |
|
response->_async = new AsyncLegacyOperationResult( |
|
requestAsync->getKey(), requestAsync->getRouting(), op, response); |
|
|
|
// set the destination |
|
op->_op_dest = op->_callback_response_q; |
|
|
|
MessageQueueService *service = |
|
dynamic_cast<MessageQueueService *>(op->_callback_response_q); |
|
|
|
PEGASUS_ASSERT(service); |
|
|
|
// the last chunk MUST be sent last, so use execute the callback |
|
// not all chunks are going through the dispatcher's chunk |
|
// resequencer, so this must be a synchronous call here |
|
// After the call is done, response and asyncResponse are now invalid |
|
// as they have been sent and deleted externally |
|
|
|
op->_async_callback(op, service, op->_callback_ptr); |
|
} |
|
catch(Exception &e) |
{ | { |
ProviderManagerContainer* pmc=_providerManagers[i]; |
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
PEG_METHOD_EXIT(); |
"Exception in ProviderManagerService::responseChunkCallback: " + |
return pmc->getProviderManager(); |
e.getMessage() + ". Chunk not delivered."); |
} | } |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"Exception in ProviderManagerService::responseChunkCallback. " |
|
"Chunk not delivered."); |
} | } |
| |
// ProviderManager not found for the specified interface type |
|
PEGASUS_ASSERT(0); |
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return 0; |
|
//ProviderManagerContainer *pmc=_providerManagers[0]; |
|
//return pmc->getProviderManager(); |
|
} | } |
| |
void ProviderManagerService::unload_idle_providers(void) |
Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) |
|
{ |
|
Message* response = 0; |
|
|
|
if ((request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) || |
|
(request->getType() == |
|
CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE) || |
|
(request->getType() == CIM_NOTIFY_CONFIG_CHANGE_REQUEST_MESSAGE)) |
{ | { |
for(Uint32 i = 0, n = _providerManagers.size(); i < n; i++) |
if (_basicProviderManagerRouter) |
{ | { |
ProviderManagerContainer *pmc=_providerManagers[i]; |
response = _basicProviderManagerRouter->processMessage(request); |
pmc->getProviderManager()->unload_idle_providers(); |
|
} |
|
} | } |
| |
ProviderIdContainer ProviderManagerService::_getProviderIdContainer( |
if (_oopProviderManagerRouter) |
const CIMRequestMessage* message) |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
// Note: These responses do not contain interesting data, so just |
"ProviderManagerService::_getProviderIdContainer"); |
// use the last one. |
|
delete response; |
| |
|
response = _oopProviderManagerRouter->processMessage(request); |
|
} |
|
} |
|
else |
|
{ |
CIMInstance providerModule; | CIMInstance providerModule; |
CIMInstance provider; |
|
| |
switch (message->getType()) |
if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
{ | { |
case CIM_GET_CLASS_REQUEST_MESSAGE: |
CIMEnableModuleRequestMessage* emReq = |
case CIM_DELETE_CLASS_REQUEST_MESSAGE: |
dynamic_cast<CIMEnableModuleRequestMessage*>(request); |
case CIM_CREATE_CLASS_REQUEST_MESSAGE: |
providerModule = emReq->providerModule; |
case CIM_MODIFY_CLASS_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_SET_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE: |
|
// The ProviderManagerService does not support class operations |
|
PEGASUS_ASSERT(0); |
|
break; |
|
|
|
case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
{ |
|
// Look up instance provider |
|
const CIMOperationRequestMessage* request = |
|
dynamic_cast<const CIMOperationRequestMessage*>(message); |
|
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule); |
|
break; |
|
} | } |
|
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) |
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
|
{ | { |
// Look up instance query provider |
CIMDisableModuleRequestMessage* dmReq = |
const CIMOperationRequestMessage* request = |
dynamic_cast<CIMDisableModuleRequestMessage*>(request); |
dynamic_cast<const CIMOperationRequestMessage*>(message); |
providerModule = dmReq->providerModule; |
Boolean hasNoQuery; |
|
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule, |
|
0, &hasNoQuery); |
|
// We shouldn't have gotten this far if this isn't a query provider |
|
PEGASUS_ASSERT(!hasNoQuery); |
|
break; |
|
} | } |
|
else |
case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
|
{ | { |
// Look up association provider |
ProviderIdContainer pidc = |
const CIMAssociatorsRequestMessage* request = |
request->operationContext.get(ProviderIdContainer::NAME); |
dynamic_cast<const CIMAssociatorsRequestMessage*>(message); |
providerModule = pidc.getModule(); |
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->assocClass, providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
Uint16 userContext = 0; |
|
Uint32 pos = providerModule.findProperty( |
|
PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT); |
|
if (pos != PEG_NOT_FOUND) |
{ | { |
// Look up association provider |
providerModule.getProperty(pos).getValue().get(userContext); |
const CIMAssociatorNamesRequestMessage* request = |
|
dynamic_cast<const CIMAssociatorNamesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->assocClass, providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_REFERENCES_REQUEST_MESSAGE: |
// Forward the request to the appropriate ProviderManagerRouter, based |
|
// on the CIM Server configuration and the UserContext setting. |
|
|
|
ConfigManager* configManager = ConfigManager::getInstance(); |
|
Boolean forceProviderProcesses = String::equal( |
|
configManager->getCurrentValue("forceProviderProcesses"), "true"); |
|
|
|
if (forceProviderProcesses |
|
#ifndef PEGASUS_DISABLE_PROV_USERCTXT |
|
|| (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) |
|
|| (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED) |
|
|| ((userContext == PG_PROVMODULE_USERCTXT_PRIVILEGED) && |
|
!System::isPrivilegedUser(System::getEffectiveUserName())) |
|
#endif |
|
) |
{ | { |
// Look up association provider |
response = _oopProviderManagerRouter->processMessage(request); |
const CIMReferencesRequestMessage* request = |
|
dynamic_cast<const CIMReferencesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->resultClass, providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
|
else |
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
|
{ | { |
// Look up association provider |
response = _basicProviderManagerRouter->processMessage(request); |
const CIMReferenceNamesRequestMessage* request = |
} |
dynamic_cast<const CIMReferenceNamesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->resultClass, providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
return response; |
{ |
|
// Look up method provider |
|
const CIMInvokeMethodRequestMessage* request = |
|
dynamic_cast<const CIMInvokeMethodRequestMessage*>(message); |
|
_providerRegistrationManager->lookupMethodProvider( |
|
request->nameSpace, request->className, request->methodName, |
|
provider, providerModule); |
|
break; |
|
} | } |
| |
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
void ProviderManagerService::unloadIdleProviders() |
{ | { |
const CIMExportIndicationRequestMessage* request = |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
dynamic_cast<const CIMExportIndicationRequestMessage*>(message); |
"ProviderManagerService::unloadIdleProviders"); |
_providerRegistrationManager->lookupIndicationConsumer( |
ThreadStatus rtn = PEGASUS_THREAD_OK; |
request->destinationPath, provider, providerModule); |
// Ensure that only one _unloadIdleProvidersHandler thread runs at a time |
break; |
_unloadIdleProvidersBusy++; |
|
if ((_unloadIdleProvidersBusy.get() == 1) && |
|
((rtn = _thread_pool->allocate_and_awaken( |
|
(void*)this, ProviderManagerService::_unloadIdleProvidersHandler))==PEGASUS_THREAD_OK)) |
|
{ |
|
// _unloadIdleProvidersBusy is decremented in |
|
// _unloadIdleProvidersHandler |
|
} |
|
else |
|
{ |
|
// If we fail to allocate a thread, don't retry now. |
|
_unloadIdleProvidersBusy--; |
} | } |
|
if (rtn != PEGASUS_THREAD_OK) |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"Not enough threads to unload idle providers."); |
| |
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
"Could not allocate thread for %s to unload idle providers.", |
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
getQueueName()); |
case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
} |
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
PEG_METHOD_EXIT(); |
{ |
|
// Provider information is already in the message |
|
const CIMIndicationRequestMessage* request = |
|
dynamic_cast<const CIMIndicationRequestMessage*>(message); |
|
providerModule = request->providerModule; |
|
provider = request->provider; |
|
break; |
|
} | } |
| |
case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw() |
case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
{ |
case CIM_PROCESS_INDICATION_REQUEST_MESSAGE: |
try |
case CIM_HANDLE_INDICATION_REQUEST_MESSAGE: |
{ |
case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE: |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE: |
"ProviderManagerService::unloadIdleProvidersHandler"); |
// These messages are not handled by the ProviderManagerService |
|
PEGASUS_ASSERT(0); |
|
break; |
|
| |
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
ProviderManagerService* myself = |
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
reinterpret_cast<ProviderManagerService*>(arg); |
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
// These messages are handled specially by the ProviderManagerService |
if (myself->_basicProviderManagerRouter) |
PEGASUS_ASSERT(0); |
{ |
break; |
try |
|
{ |
|
myself->_basicProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"BasicProviderManagerRouter::_unloadIdleProviders"); |
|
} |
} | } |
| |
PEGASUS_ASSERT(!providerModule.isUninitialized()); |
if (myself->_oopProviderManagerRouter) |
PEGASUS_ASSERT(!provider.isUninitialized()); |
{ |
|
try |
|
{ |
|
myself->_oopProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"OOPProviderManagerRouter::_unloadIdleProviders"); |
|
} |
|
} |
| |
|
myself->_unloadIdleProvidersBusy--; |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return ProviderIdContainer(providerModule, provider); |
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception in _unloadIdleProvidersHandler"); |
|
} |
|
|
|
return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
// Updates the providerModule instance and the ProviderRegistrationManager | // Updates the providerModule instance and the ProviderRegistrationManager |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
void ProviderManagerService::indicationCallback( |
|
CIMProcessIndicationRequestMessage* request) |
|
{ |
|
try |
|
{ |
|
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
|
}catch(const Exception &) |
|
{ |
|
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguageList())); |
|
} |
|
|
|
if (_indicationServiceQueueId == PEG_NOT_FOUND) |
|
{ |
|
Array<Uint32> serviceIds; |
|
|
|
providerManagerService->find_services( |
|
PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds); |
|
PEGASUS_ASSERT(serviceIds.size() != 0); |
|
|
|
_indicationServiceQueueId = serviceIds[0]; |
|
} |
|
|
|
request->queueIds = QueueIdStack( |
|
_indicationServiceQueueId, providerManagerService->getQueueId()); |
|
|
|
AsyncLegacyOperationStart * asyncRequest = |
|
new AsyncLegacyOperationStart( |
|
providerManagerService->get_next_xid(), |
|
0, |
|
_indicationServiceQueueId, |
|
request, |
|
_indicationServiceQueueId); |
|
|
|
providerManagerService->SendForget(asyncRequest); |
|
|
|
|
|
|
|
|
|
#ifdef PEGASUS_INDICATIONS_Q_THRESHOLD |
|
|
|
// See Comments in config.mak asociated with |
|
// PEGASUS_INDICATIONS_Q_THRESHOLD |
|
// |
|
// if INDICATIONS_Q_STALL THRESHOLD is gt 0 |
|
// then if there are over INDICATIONS_Q_STALL_THRESHOLD |
|
// indications in the queue |
|
// then force this provider to sleep until the queue count |
|
// is lower than INDICATIONS_Q_RESUME_THRESHOLD |
|
|
|
static Mutex indicationThresholdReportedLock; |
|
static Boolean indicationThresholdReported = false; |
|
|
|
#define INDICATIONS_Q_STALL_THRESHOLD PEGASUS_INDICATIONS_Q_THRESHOLD |
|
#define INDICATIONS_Q_RESUME_THRESHOLD (int)(PEGASUS_INDICATIONS_Q_THRESHOLD*.90) |
|
#define INDICATIONS_Q_STALL_DURATION 250 // milli-seconds |
|
|
|
MessageQueue * indicationsQueue = MessageQueue::lookup(_indicationServiceQueueId); |
|
|
|
if (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_STALL_THRESHOLD) |
|
{ |
|
AutoMutex indicationThresholdReportedAutoMutex(indicationThresholdReportedLock); |
|
if (!indicationThresholdReported) |
|
{ |
|
indicationThresholdReported = true; |
|
indicationThresholdReportedAutoMutex.unlock(); |
|
|
|
// make log entry to record que max exceeded |
|
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"Indication generation stalled: maximum queue count ($0) exceeded.", |
|
INDICATIONS_Q_STALL_THRESHOLD); |
|
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex.unlock(); |
|
} |
|
|
|
while (((MessageQueueService *)indicationsQueue)->getIncomingCount() > INDICATIONS_Q_RESUME_THRESHOLD) |
|
{ |
|
pegasus_sleep(INDICATIONS_Q_STALL_DURATION); |
|
} |
|
|
|
AutoMutex indicationThresholdReportedAutoMutex1(indicationThresholdReportedLock); |
|
// indicationThresholdReportedLock.lock(pegasus_thread_self()); |
|
if(indicationThresholdReported) |
|
{ |
|
indicationThresholdReported = false; |
|
indicationThresholdReportedAutoMutex1.unlock(); |
|
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"Indication generation resumed: current queue count = $0", |
|
((MessageQueueService *)indicationsQueue)->getIncomingCount() ); |
|
|
|
} |
|
else |
|
{ |
|
indicationThresholdReportedAutoMutex1.unlock(); |
|
} |
|
} |
|
#endif /* INDICATIONS_Q_STALL_THRESHOLD */ |
|
|
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |