(file) Return to CIMListenerIndicationDispatcher.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Listener

Diff for /pegasus/src/Pegasus/Listener/CIMListenerIndicationDispatcher.cpp between version 1.14.12.2 and 1.17

version 1.14.12.2, 2007/04/04 11:04:49 version 1.17, 2007/07/06 13:47:36
Line 71 
Line 71 
         ContentLanguageList                    _contentLangs;         ContentLanguageList                    _contentLangs;
 }; };
  
 CIMListenerIndicationDispatchEvent::CIMListenerIndicationDispatchEvent(CIMIndicationConsumer* consumer,  CIMListenerIndicationDispatchEvent::CIMListenerIndicationDispatchEvent(
       CIMIndicationConsumer* consumer,
                                                                        String url,                                                                        String url,
                                                                        CIMInstance instance,                                                                        CIMInstance instance,
                                                                        ContentLanguageList contentLangs)                                                                        ContentLanguageList contentLangs)
Line 93 
Line 94 
 { {
         return _instance;         return _instance;
 } }
 ContentLanguageList CIMListenerIndicationDispatchEvent::getContentLanguages() const  ContentLanguageList
       CIMListenerIndicationDispatchEvent::getContentLanguages() const
 { {
         return _contentLangs;         return _contentLangs;
 } }
Line 110 
Line 112 
         Boolean addConsumer(CIMIndicationConsumer* consumer);         Boolean addConsumer(CIMIndicationConsumer* consumer);
         Boolean removeConsumer(CIMIndicationConsumer* consumer);         Boolean removeConsumer(CIMIndicationConsumer* consumer);
  
         CIMExportIndicationResponseMessage* handleIndicationRequest(CIMExportIndicationRequestMessage* request);      CIMExportIndicationResponseMessage* handleIndicationRequest(
           CIMExportIndicationRequestMessage* request);
  
  
         static ThreadReturnType PEGASUS_THREAD_CDECL deliver_routine(void *param);         static ThreadReturnType PEGASUS_THREAD_CDECL deliver_routine(void *param);
  
 private: private:
         void    deliverIndication(String url, CIMInstance instance, ContentLanguageList contentLangs);      void    deliverIndication(String url,
                                 CIMInstance instance,
                                 ContentLanguageList contentLangs);
  
         ThreadPool* _thread_pool;         ThreadPool* _thread_pool;
         PtrList*                _consumers;         PtrList*                _consumers;
Line 127 
Line 132 
  
 CIMListenerIndicationDispatcherRep::CIMListenerIndicationDispatcherRep() CIMListenerIndicationDispatcherRep::CIMListenerIndicationDispatcherRep()
 :_thread_pool(new ThreadPool(0, "ListenerIndicationDispatcher", 0, 0, :_thread_pool(new ThreadPool(0, "ListenerIndicationDispatcher", 0, 0,
         deallocateWait))      deallocateWait)), _consumers(new PtrList())
 ,_consumers(new PtrList())  
 { {
  
 } }
Line 138 
Line 142 
         delete _consumers;         delete _consumers;
 } }
  
 Boolean CIMListenerIndicationDispatcherRep::addConsumer(CIMIndicationConsumer* consumer)  Boolean CIMListenerIndicationDispatcherRep::addConsumer(
       CIMIndicationConsumer* consumer)
 { {
         _consumers->add(consumer);         _consumers->add(consumer);
         return true;         return true;
 } }
 Boolean CIMListenerIndicationDispatcherRep::removeConsumer(CIMIndicationConsumer* consumer)  Boolean CIMListenerIndicationDispatcherRep::removeConsumer(
       CIMIndicationConsumer* consumer)
 { {
         _consumers->remove(consumer);         _consumers->remove(consumer);
         return true;         return true;
 } }
 CIMExportIndicationResponseMessage* CIMListenerIndicationDispatcherRep::handleIndicationRequest(CIMExportIndicationRequestMessage* request)  CIMExportIndicationResponseMessage*
   CIMListenerIndicationDispatcherRep::handleIndicationRequest(
       CIMExportIndicationRequestMessage* request)
 { {
         PEG_METHOD_ENTER(TRC_SERVER,         PEG_METHOD_ENTER(TRC_SERVER,
                 "CIMListenerIndicationDispatcherRep::handleIndicationRequest");                 "CIMListenerIndicationDispatcherRep::handleIndicationRequest");
  
         CIMInstance instance = request->indicationInstance;         CIMInstance instance = request->indicationInstance;
         String                  url = request->destinationPath;         String                  url = request->destinationPath;
     ContentLanguageList contentLangs =((ContentLanguageListContainer)request->operationContext.      ContentLanguageList contentLangs =
           ((ContentLanguageListContainer)request->operationContext.
                                                             get(ContentLanguageListContainer::NAME)).getLanguages();                                                             get(ContentLanguageListContainer::NAME)).getLanguages();
  
         deliverIndication(url,instance,contentLangs);         deliverIndication(url,instance,contentLangs);
Line 163 
Line 172 
         // compose a response message         // compose a response message
         CIMException cimException;         CIMException cimException;
  
         CIMExportIndicationResponseMessage* response = new CIMExportIndicationResponseMessage(      CIMExportIndicationResponseMessage* response =
                 request->messageId,          new CIMExportIndicationResponseMessage(request->messageId,
                 cimException,                 cimException,
                 request->queueIds.copyAndPop());                 request->queueIds.copyAndPop());
  
Line 179 
Line 188 
                                                            CIMInstance instance,                                                            CIMInstance instance,
                                                            ContentLanguageList contentLangs)                                                            ContentLanguageList contentLangs)
 { {
         // go thru all consumers and broadcast the result; should be run in seperate thread      // go thru all consumers and broadcast the result;
       // should be run in seperate thread
         AutoPtr<Iterator> it(_consumers->iterator());         AutoPtr<Iterator> it(_consumers->iterator());
   
         while(it->hasNext()==true)         while(it->hasNext()==true)
         {         {
                 CIMIndicationConsumer* consumer = static_cast<CIMIndicationConsumer*>(it->next());          CIMIndicationConsumer* consumer =
                 CIMListenerIndicationDispatchEvent* event = new CIMListenerIndicationDispatchEvent(              static_cast<CIMIndicationConsumer*>(it->next());
                                                                                      consumer,          CIMListenerIndicationDispatchEvent* event =
               new CIMListenerIndicationDispatchEvent(consumer,
                                                                                      url,                                                                                      url,
                                                                                      instance,                                                                                      instance,
                                                                                      contentLangs);                                                                                      contentLangs);
                 ThreadStatus rtn = _thread_pool->allocate_and_awaken(event,deliver_routine);          ThreadStatus rtn = _thread_pool->allocate_and_awaken(
                                   event,deliver_routine);
  
                 if (rtn != PEGASUS_THREAD_OK)                 if (rtn != PEGASUS_THREAD_OK)
                 {                 {
                     Logger::put(Logger::STANDARD_LOG, System::CIMLISTENER, Logger::TRACE,                  Logger::put(Logger::STANDARD_LOG, System::CIMLISTENER,
                                 "Not enough threads to allocate a worker to deliver the event. ");                      Logger::TRACE,
                       "Not enough threads to allocate a worker to deliver"
                           " the event. ");
  
                     PEG_TRACE_CSTRING(TRC_SERVER, Tracer::LEVEL2,                     PEG_TRACE_CSTRING(TRC_SERVER, Tracer::LEVEL2,
                                 "Could not allocate thread to deliver event. Instead using current thread.");                      "Could not allocate thread to deliver event."
                           " Instead using current thread.");
                     delete event;                     delete event;
                     throw Exception(MessageLoaderParms("Listener.CIMListenerIndicationDispatcher.CANNOT_ALLOCATE_THREAD",              throw Exception(MessageLoaderParms(
                                         "Not enough threads to allocate a worker to deliver the event."));                  "Listener.CIMListenerIndicationDispatcher."
                       "CANNOT_ALLOCATE_THREAD",
                   "Not enough threads to allocate a worker to deliver the"
                       " event."));
                 }                 }
         }         }
 } }
 ThreadReturnType PEGASUS_THREAD_CDECL CIMListenerIndicationDispatcherRep::deliver_routine(void *param)  ThreadReturnType PEGASUS_THREAD_CDECL
   CIMListenerIndicationDispatcherRep::deliver_routine(void *param)
 { {
         CIMListenerIndicationDispatchEvent* event = static_cast<CIMListenerIndicationDispatchEvent*>(param);      CIMListenerIndicationDispatchEvent* event =
           static_cast<CIMListenerIndicationDispatchEvent*>(param);
  
         if(event!=NULL)         if(event!=NULL)
         {         {
                 CIMIndicationConsumer* consumer = event->getConsumer();                 CIMIndicationConsumer* consumer = event->getConsumer();
                 OperationContext context;                 OperationContext context;
                 context.insert(ContentLanguageListContainer(event->getContentLanguages()));              context.insert(ContentLanguageListContainer(
                           event->getContentLanguages()));
                 if(consumer)                 if(consumer)
                 {                 {
                         consumer->consumeIndication(context,event->getURL(),event->getIndicationInstance());              consumer->consumeIndication(context,
                   event->getURL(),event->getIndicationInstance());
                 }                 }
  
                 delete event;                 delete event;
Line 242 
Line 265 
  
 void CIMListenerIndicationDispatcher::handleEnqueue() void CIMListenerIndicationDispatcher::handleEnqueue()
 { {
         PEG_METHOD_ENTER(TRC_SERVER, "CIMListenerIndicationDispatcher::handleEnqueue");      PEG_METHOD_ENTER(TRC_SERVER,
           "CIMListenerIndicationDispatcher::handleEnqueue");
  
         Message *message = dequeue();         Message *message = dequeue();
         if(message)         if(message)
Line 253 
Line 277 
  
 void CIMListenerIndicationDispatcher::handleEnqueue(Message* message) void CIMListenerIndicationDispatcher::handleEnqueue(Message* message)
 { {
         PEG_METHOD_ENTER(TRC_SERVER, "CIMListenerIndicationDispatcher::handleEnqueue");      PEG_METHOD_ENTER(TRC_SERVER,
           "CIMListenerIndicationDispatcher::handleEnqueue");
  
         if(message!=NULL)         if(message!=NULL)
         {         {
Line 261 
Line 286 
     {     {
                         case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:                         case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
                                 {                                 {
                                         CIMExportIndicationRequestMessage* request = (CIMExportIndicationRequestMessage*)message;                      CIMExportIndicationRequestMessage* request =
                           (CIMExportIndicationRequestMessage*)message;
  
                                         CIMExportIndicationResponseMessage* response =                                         CIMExportIndicationResponseMessage* response =
                                                 static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->handleIndicationRequest(request);                          static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->
                               handleIndicationRequest(request);
  
                                         _enqueueResponse(request, response);                                         _enqueueResponse(request, response);
                                 }                                 }
Line 277 
Line 304 
  
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
 } }
 Boolean CIMListenerIndicationDispatcher::addConsumer(CIMIndicationConsumer* consumer)  Boolean CIMListenerIndicationDispatcher::addConsumer(
       CIMIndicationConsumer* consumer)
 { {
         return static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->addConsumer(consumer);      return static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->addConsumer(
               consumer);
 } }
 Boolean CIMListenerIndicationDispatcher::removeConsumer(CIMIndicationConsumer* consumer)  Boolean CIMListenerIndicationDispatcher::removeConsumer(
           CIMIndicationConsumer* consumer)
 { {
         return static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->removeConsumer(consumer);      return static_cast<CIMListenerIndicationDispatcherRep*>
           (_rep)->removeConsumer(consumer);
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.14.12.2  
changed lines
  Added in v.1.17

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2