version 1.1, 2004/06/26 03:24:20
|
version 1.2, 2004/06/28 22:51:39
|
|
|
updating the _outstandingRequestTable. | updating the _outstandingRequestTable. |
*/ | */ |
Mutex _outstandingRequestTableMutex; | Mutex _outstandingRequestTableMutex; |
|
|
|
/** |
|
Holds the last provider module instance sent to the Provider Agent in |
|
a ProviderIdContainer. Since the provider module instance rarely |
|
changes, an optimization is used to send it only when it differs from |
|
the last provider module instance sent. |
|
*/ |
|
CIMInstance _providerModuleCache; |
}; | }; |
| |
ProviderAgentContainer::ProviderAgentContainer( | ProviderAgentContainer::ProviderAgentContainer( |
|
|
_pipeFromAgent.reset(); | _pipeFromAgent.reset(); |
_pipeToAgent.reset(); | _pipeToAgent.reset(); |
| |
|
_providerModuleCache = CIMInstance(); |
|
|
_isInitialized = false; | _isInitialized = false; |
| |
// | // |
|
|
CIMResponseMessage* response; | CIMResponseMessage* response; |
String originalMessageId = request->messageId; | String originalMessageId = request->messageId; |
| |
|
// These three variables are used for the provider module optimization. |
|
// See the _providerModuleCache member description for more information. |
|
AutoPtr<ProviderIdContainer> origProviderId; |
|
Boolean doProviderModuleOptimization = false; |
|
Boolean updateProviderModuleCache = false; |
|
|
try | try |
{ | { |
// The messageId attribute is used to correlate response messages | // The messageId attribute is used to correlate response messages |
|
|
uniqueMessageId, &outstandingRequestEntry); | uniqueMessageId, &outstandingRequestEntry); |
} | } |
| |
|
// Get the provider module from the ProviderIdContainer to see if |
|
// we can optimize out the transmission of this instance to the |
|
// Provider Agent. (See the _providerModuleCache description.) |
|
try |
|
{ |
|
ProviderIdContainer pidc = request->operationContext.get( |
|
ProviderIdContainer::NAME); |
|
origProviderId.reset(new ProviderIdContainer( |
|
pidc.getModule(), pidc.getProvider(), |
|
pidc.isRemoteNameSpace(), pidc.getRemoteInfo())); |
|
if (_providerModuleCache.isUninitialized() || |
|
(!pidc.getModule().identical(_providerModuleCache))) |
|
{ |
|
// We haven't sent this provider module instance to the |
|
// Provider Agent yet. Update our cache after we send it. |
|
updateProviderModuleCache = true; |
|
} |
|
else |
|
{ |
|
// Replace the provider module in the ProviderIdContainer |
|
// with an uninitialized instance. We'll need to put the |
|
// original one back after the message is sent. |
|
request->operationContext.set(ProviderIdContainer( |
|
CIMInstance(), pidc.getProvider(), |
|
pidc.isRemoteNameSpace(), pidc.getRemoteInfo())); |
|
doProviderModuleOptimization = true; |
|
} |
|
} |
|
catch (...) |
|
{ |
|
// No ProviderIdContainer to optimize |
|
} |
|
|
// | // |
// Write the message to the pipe | // Write the message to the pipe |
// | // |
|
|
_pipeToAgent->writeMessage(request); | _pipeToAgent->writeMessage(request); |
request->messageId = originalMessageId; | request->messageId = originalMessageId; |
| |
|
if (doProviderModuleOptimization) |
|
{ |
|
request->operationContext.set(*origProviderId.get()); |
|
} |
|
|
if (writeStatus != AnonymousPipe::STATUS_SUCCESS) | if (writeStatus != AnonymousPipe::STATUS_SUCCESS) |
{ | { |
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, | Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
|
"Failed to communicate with cimprovagt \"$0\".", | "Failed to communicate with cimprovagt \"$0\".", |
_moduleName)); | _moduleName)); |
} | } |
|
|
|
if (updateProviderModuleCache) |
|
{ |
|
_providerModuleCache = origProviderId->getModule(); |
|
} |
} | } |
catch (...) | catch (...) |
{ | { |
request->messageId = originalMessageId; | request->messageId = originalMessageId; |
|
|
|
if (doProviderModuleOptimization) |
|
{ |
|
request->operationContext.set(*origProviderId.get()); |
|
} |
|
|
Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, | Tracer::trace(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"Failed to write message to pipe."); | "Failed to write message to pipe."); |
// Remove the OutstandingRequestTable entry for this request | // Remove the OutstandingRequestTable entry for this request |