version 1.41, 2006/07/07 14:43:46
|
version 1.44, 2006/09/15 18:06:12
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Dong Xiang, EMC Corporation (xiang_dong@emc.com) |
|
// |
|
// Modified By: Dan Gorey (djgorey@us.ibm.com) |
|
// Amit K Arora, IBM (amita@in.ibm.com) for PEP#183 |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// Vijay Eli, IBM (vijay.eli@in.ibm.com) for bug#3425 |
|
// Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3604 |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "CIMListener.h" | #include "CIMListener.h" |
|
|
#include <Pegasus/Common/HTTPAcceptor.h> | #include <Pegasus/Common/HTTPAcceptor.h> |
#include <Pegasus/Common/PegasusVersion.h> | #include <Pegasus/Common/PegasusVersion.h> |
#include <Pegasus/Common/MessageLoader.h> | #include <Pegasus/Common/MessageLoader.h> |
|
#include <Pegasus/Common/Time.h> |
#include <Pegasus/ExportServer/CIMExportResponseEncoder.h> | #include <Pegasus/ExportServer/CIMExportResponseEncoder.h> |
#include <Pegasus/ExportServer/CIMExportRequestDecoder.h> | #include <Pegasus/ExportServer/CIMExportRequestDecoder.h> |
#include <Pegasus/Consumer/CIMIndicationConsumer.h> | #include <Pegasus/Consumer/CIMIndicationConsumer.h> |
|
|
*/ | */ |
Uint32 getPortNumber() const; | Uint32 getPortNumber() const; |
| |
static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
static ThreadReturnType PEGASUS_THREAD_CDECL |
_listener_routine(void *param); | _listener_routine(void *param); |
| |
private: | private: |
|
|
| |
void CIMListenerService::runForever() | void CIMListenerService::runForever() |
{ | { |
static int modulator = 0; |
|
|
|
if (!_dieNow) | if (!_dieNow) |
{ | { |
if (false == _monitor->run(500000)) |
_monitor->run(500000); |
|
static struct timeval lastIdleCleanupTime = {0, 0}; |
|
struct timeval now; |
|
Time::gettimeofday(&now); |
|
if (now.tv_sec - lastIdleCleanupTime.tv_sec > 300) |
{ | { |
modulator++; |
lastIdleCleanupTime.tv_sec = now.tv_sec; |
try | try |
{ | { |
MessageQueueService::get_thread_pool()->cleanupIdleThreads(); | MessageQueueService::get_thread_pool()->cleanupIdleThreads(); |
|
|
return (portNumber); | return (portNumber); |
} | } |
| |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
ThreadReturnType PEGASUS_THREAD_CDECL |
CIMListenerService::_listener_routine(void *param) | CIMListenerService::_listener_routine(void *param) |
{ | { |
CIMListenerService *svc = reinterpret_cast < CIMListenerService * >(param); | CIMListenerService *svc = reinterpret_cast < CIMListenerService * >(param); |
|
|
// _dieNow to true and called Monitor::tickle(). We must wait until we | // _dieNow to true and called Monitor::tickle(). We must wait until we |
// can obtain the _monitorMutex, indicating that we are no longer inside | // can obtain the _monitorMutex, indicating that we are no longer inside |
// Monitor::tickle(). | // Monitor::tickle(). |
svc->_monitorMutex.lock(pegasus_thread_self()); |
svc->_monitorMutex.lock(); |
svc->_monitorMutex.unlock(); | svc->_monitorMutex.unlock(); |
delete svc; | delete svc; |
| |
|
|
{ | { |
reqCount = _svc->getOutstandingRequestCount(); | reqCount = _svc->getOutstandingRequestCount(); |
if (reqCount > 0) | if (reqCount > 0) |
pegasus_sleep(100); |
Threads::sleep(100); |
else | else |
return true; | return true; |
} | } |