(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.5 and 1.13

version 1.5, 2004/06/24 14:50:50 version 1.13, 2006/08/09 21:12:59
Line 1 
Line 1 
 //%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
Line 41 
Line 47 
  
 #include <Pegasus/Listener/List.h> #include <Pegasus/Listener/List.h>
 #include <Pegasus/Consumer/CIMIndicationConsumer.h> #include <Pegasus/Consumer/CIMIndicationConsumer.h>
 #include <Pegasus/Common/ContentLanguages.h>  #include <Pegasus/Common/ContentLanguageList.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 54 
Line 60 
         CIMListenerIndicationDispatchEvent(CIMIndicationConsumer* consumer,         CIMListenerIndicationDispatchEvent(CIMIndicationConsumer* consumer,
                                            String url,                                            String url,
                                            CIMInstance instance,                                            CIMInstance instance,
                                            ContentLanguages contentLangs);                                             ContentLanguageList contentLangs);
         ~CIMListenerIndicationDispatchEvent();         ~CIMListenerIndicationDispatchEvent();
  
         CIMIndicationConsumer* getConsumer() const;         CIMIndicationConsumer* getConsumer() const;
  
         String getURL() const;         String getURL() const;
         CIMInstance getIndicationInstance() const;         CIMInstance getIndicationInstance() const;
         ContentLanguages getContentLanguages() const;          ContentLanguageList getContentLanguages() const;
  
 private: private:
         CIMIndicationConsumer*  _consumer;         CIMIndicationConsumer*  _consumer;
         String                                                                  _url;         String                                                                  _url;
         CIMInstance                                                     _instance;         CIMInstance                                                     _instance;
         ContentLanguages                    _contentLangs;          ContentLanguageList                    _contentLangs;
 }; };
  
 CIMListenerIndicationDispatchEvent::CIMListenerIndicationDispatchEvent(CIMIndicationConsumer* consumer, CIMListenerIndicationDispatchEvent::CIMListenerIndicationDispatchEvent(CIMIndicationConsumer* consumer,
                                                                        String url,                                                                        String url,
                                                                        CIMInstance instance,                                                                        CIMInstance instance,
                                                                        ContentLanguages contentLangs)                                                                         ContentLanguageList contentLangs)
 :_consumer(consumer),_url(url),_instance(instance), _contentLangs(contentLangs) :_consumer(consumer),_url(url),_instance(instance), _contentLangs(contentLangs)
 { {
 } }
Line 92 
Line 98 
 { {
         return _instance;         return _instance;
 } }
 ContentLanguages CIMListenerIndicationDispatchEvent::getContentLanguages() const  ContentLanguageList CIMListenerIndicationDispatchEvent::getContentLanguages() const
 { {
         return _contentLangs;         return _contentLangs;
 } }
Line 112 
Line 118 
         CIMExportIndicationResponseMessage* handleIndicationRequest(CIMExportIndicationRequestMessage* request);         CIMExportIndicationResponseMessage* handleIndicationRequest(CIMExportIndicationRequestMessage* request);
  
  
         static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL deliver_routine(void *param);          static ThreadReturnType PEGASUS_THREAD_CDECL deliver_routine(void *param);
  
 private: private:
         void    deliverIndication(String url, CIMInstance instance, ContentLanguages contentLangs);          void    deliverIndication(String url, CIMInstance instance, ContentLanguageList contentLangs);
  
         ThreadPool* _thread_pool;         ThreadPool* _thread_pool;
         PtrList*                _consumers;         PtrList*                _consumers;
 }; };
  
 static struct timeval create_time = {0, 1};  static struct timeval deallocateWait = {15, 0};
 static struct timeval destroy_time = {15, 0};  
 static struct timeval deadlock_time = {0, 0};  
  
  
 CIMListenerIndicationDispatcherRep::CIMListenerIndicationDispatcherRep() CIMListenerIndicationDispatcherRep::CIMListenerIndicationDispatcherRep()
 :_thread_pool(new ThreadPool(0, "ListenerIndicationDispatcher", 0, 0, :_thread_pool(new ThreadPool(0, "ListenerIndicationDispatcher", 0, 0,
         create_time, destroy_time, deadlock_time))          deallocateWait))
 ,_consumers(new PtrList()) ,_consumers(new PtrList())
 { {
  
 } }
 CIMListenerIndicationDispatcherRep::~CIMListenerIndicationDispatcherRep() CIMListenerIndicationDispatcherRep::~CIMListenerIndicationDispatcherRep()
 { {
         if(_thread_pool!=NULL)  
         {  
                  _thread_pool->kill_dead_threads();  
                  delete _thread_pool;                  delete _thread_pool;
   }  
         if(_consumers!=NULL)  
                 delete _consumers;                 delete _consumers;
 } }
  
Line 161 
Line 160 
  
         CIMInstance instance = request->indicationInstance;         CIMInstance instance = request->indicationInstance;
         String                  url = request->destinationPath;         String                  url = request->destinationPath;
     ContentLanguages 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 183 
Line 182 
  
 void CIMListenerIndicationDispatcherRep::deliverIndication(String url, void CIMListenerIndicationDispatcherRep::deliverIndication(String url,
                                                            CIMInstance instance,                                                            CIMInstance instance,
                                                            ContentLanguages 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
         Iterator* it = _consumers->iterator();         Iterator* it = _consumers->iterator();
Line 195 
Line 194 
                                                                                      url,                                                                                      url,
                                                                                      instance,                                                                                      instance,
                                                                                      contentLangs);                                                                                      contentLangs);
                 _thread_pool->allocate_and_awaken(event,deliver_routine);                  ThreadStatus rtn = _thread_pool->allocate_and_awaken(event,deliver_routine);
   
                   if (rtn != PEGASUS_THREAD_OK)
                   {
                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
                                   "Not enough threads to allocate a worker to deliver the event. ");
   
                       Tracer::trace(TRC_SERVER, Tracer::LEVEL2,
                                   "Could not allocate thread to deliver event. Instead using current thread.");
                       delete event;
                       throw Exception(MessageLoaderParms("Listener.CIMListenerIndicationDispatcher.CANNOT_ALLOCATE_THREAD",
                                           "Not enough threads to allocate a worker to deliver the event."));
                   }
         }         }
 } }
 PEGASUS_THREAD_RETURN 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);
  


Legend:
Removed from v.1.5  
changed lines
  Added in v.1.13

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2