(file) Return to MessageQueueService.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.50 //%2006////////////////////////////////////////////////////////////////////////
  2 mday  1.1  //
  3 karl  1.41 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.39 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.41 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.42 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.50 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mday  1.1  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 karl  1.50 // 
 21 mday  1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            #ifndef Pegasus_MessageQueue_Service_h
 35            #define Pegasus_MessageQueue_Service_h
 36            
 37            #include <Pegasus/Common/Config.h>
 38            #include <Pegasus/Common/Message.h>
 39 kumpf 1.34 #include <Pegasus/Common/InternalException.h>
 40 mday  1.1  #include <Pegasus/Common/Thread.h>
 41 mike  1.54 #include <Pegasus/Common/ThreadPool.h>
 42 mday  1.1  #include <Pegasus/Common/AsyncOpNode.h>
 43            #include <Pegasus/Common/Cimom.h>
 44 mike  1.51 #include <Pegasus/Common/Mutex.h>
 45 mday  1.1  #include <Pegasus/Common/CimomMessage.h>
 46 kumpf 1.33 #include <Pegasus/Common/Linkage.h>
 47 mike  1.54 #include <Pegasus/Common/Mutex.h>
 48 mday  1.1  
 49            PEGASUS_NAMESPACE_BEGIN
 50            
 51 mday  1.10 extern const Uint32 CIMOM_Q_ID;
 52 mday  1.9  
 53 mday  1.3  class message_module;
 54 marek 1.56 class cimom;
 55 mday  1.3  
 56 mike  1.51 
 57 kumpf 1.59 class PEGASUS_COMMON_LINKAGE MessageQueueService :
 58 mike  1.51     public Linkable, public MessageQueue
 59 mday  1.1  {
 60 david.dillard 1.45 public:
 61                    
 62                        typedef MessageQueue Base;
 63 mday          1.1  
 64 kumpf         1.55     MessageQueueService(
 65 kumpf         1.59         const char* name,
 66 venkat.puvvada 1.66         Uint32 queueID = MessageQueue::getNextQueueId());
 67 david.dillard  1.45 
 68                         virtual ~MessageQueueService();
 69                     
 70                         virtual Boolean isAsync() const {  return true;  }
 71                     
 72                         virtual void enqueue(Message *);
 73                     
 74 kumpf          1.59     AsyncReply* SendWait(AsyncRequest* request);
 75                         Boolean SendAsync(AsyncOpNode* op,
 76                             Uint32 destination,
 77                             void (*callback)(AsyncOpNode*, MessageQueue*, void*),
 78                             MessageQueue* callback_q,
 79                             void* callback_ptr);
 80 david.dillard  1.45 
 81 kumpf          1.59     Boolean SendForget(Message* msg);
 82 david.dillard  1.45 
 83                         Boolean update_service(Uint32 capabilities, Uint32 mask);
 84                         Boolean deregister_service();
 85                     
 86 venkat.puvvada 1.64     Uint32 find_service_qid(const String &name);
 87 kumpf          1.59     static AsyncOpNode* get_op();
 88                         void return_op(AsyncOpNode* op);
 89 venkat.puvvada 1.66     Boolean isRunning() const { return _isRunning; }
 90 david.dillard  1.45 
 91 kumpf          1.59     static ThreadPool* get_thread_pool();
 92 david.dillard  1.45 
 93                         AtomicInt _die;
 94 kumpf          1.59     AtomicInt _threads;
 95                         Uint32 getIncomingCount() {return _incoming.count(); }
 96 david.dillard  1.45 
 97                     protected:
 98 kumpf          1.59     virtual Boolean accept_async(AsyncOpNode* op);
 99 david.dillard  1.45     virtual void handleEnqueue() = 0;
100                         virtual void handleEnqueue(Message *) = 0;
101                         Boolean _enqueueResponse(Message *, Message *);
102                         virtual void _handle_incoming_operation(AsyncOpNode *);
103                     
104 kumpf          1.59     virtual void _handle_async_request(AsyncRequest* req);
105                         virtual void _handle_async_callback(AsyncOpNode* operation);
106                         virtual void _make_response(Message* req, Uint32 code);
107                     
108 venkat.puvvada 1.69     virtual void handle_AsyncIoClose(AsyncIoClose* req);
109 kumpf          1.59     virtual void handle_CimServiceStart(CimServiceStart* req);
110                         virtual void handle_CimServiceStop(CimServiceStop* req);
111                     
112                         void _completeAsyncResponse(
113                             AsyncRequest* request,
114 venkat.puvvada 1.67         AsyncReply* reply);
115                         void _complete_op_node(AsyncOpNode *);
116 david.dillard  1.45 
117 kumpf          1.59     static cimom* _meta_dispatcher;
118 david.dillard  1.45     static AtomicInt _service_count;
119                         static Mutex _meta_dispatcher_mutex;
120 kumpf          1.59     static ThreadPool* _thread_pool;
121 venkat.puvvada 1.66     Boolean _isRunning;
122 david.dillard  1.45 private:
123 venkat.puvvada 1.65     Boolean _sendAsync(AsyncOpNode* op,
124                             Uint32 destination,
125                             void (*callback)(AsyncOpNode*, MessageQueue*, void*),
126                             MessageQueue* callback_q,
127                             void* callback_ptr,
128                             Uint32 flags);
129                     
130 venkat.puvvada 1.69     void _removeFromPollingList(MessageQueueService *service);
131                     
132 kumpf          1.57     static ThreadReturnType PEGASUS_THREAD_CDECL polling_routine(void *);
133                     
134 mike           1.51     AsyncQueue<AsyncOpNode> _incoming;
135 david.dillard  1.45     static Thread* _polling_thread;
136                         static Semaphore _polling_sem;
137                         static AtomicInt _stop_polling;
138                     
139 mike           1.54     typedef List<MessageQueueService, Mutex> PollingList;
140 mike           1.51     static PollingList* _polling_list;
141                         static Mutex _polling_list_mutex;
142                     
143                         PollingList* _get_polling_list();
144 david.dillard  1.45 
145 mike           1.54     static ThreadReturnType PEGASUS_THREAD_CDECL _req_proc(void *);
146 david.dillard  1.45 
147                         static void _sendwait_callback(AsyncOpNode *, MessageQueue *, void *);
148                     
149                         AtomicInt _incoming_queue_shutdown;
150                     
151                         friend class cimom;
152 mday           1.1  };
153                     
154                     PEGASUS_NAMESPACE_END
155                     
156                     #endif /* Pegasus_MessageQueue_Service_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2