00001
00002 #ifndef _MANAGEMENT_QUEUE_
00003 #define _MANAGEMENT_QUEUE_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "qpid/management/ManagementObject.h"
00028 #include "qpid/framing/Uuid.h"
00029
00030 namespace qpid {
00031 namespace management {
00032
00033 class Queue : public ManagementObject
00034 {
00035 private:
00036
00037 static std::string packageName;
00038 static std::string className;
00039 static uint8_t md5Sum[16];
00040
00041
00042 uint64_t vhostRef;
00043 std::string name;
00044 uint8_t durable;
00045 uint8_t autoDelete;
00046 uint8_t exclusive;
00047 framing::FieldTable arguments;
00048 uint64_t storeRef;
00049
00050
00051 uint64_t msgTotalEnqueues;
00052 uint64_t msgTotalDequeues;
00053 uint64_t msgTxnEnqueues;
00054 uint64_t msgTxnDequeues;
00055 uint64_t msgPersistEnqueues;
00056 uint64_t msgPersistDequeues;
00057 uint32_t msgDepth;
00058 uint32_t msgDepthHigh;
00059 uint32_t msgDepthLow;
00060 uint64_t byteTotalEnqueues;
00061 uint64_t byteTotalDequeues;
00062 uint64_t byteTxnEnqueues;
00063 uint64_t byteTxnDequeues;
00064 uint64_t bytePersistEnqueues;
00065 uint64_t bytePersistDequeues;
00066 uint32_t byteDepth;
00067 uint32_t byteDepthHigh;
00068 uint32_t byteDepthLow;
00069 uint64_t enqueueTxnStarts;
00070 uint64_t enqueueTxnCommits;
00071 uint64_t enqueueTxnRejects;
00072 uint32_t enqueueTxnCount;
00073 uint32_t enqueueTxnCountHigh;
00074 uint32_t enqueueTxnCountLow;
00075 uint64_t dequeueTxnStarts;
00076 uint64_t dequeueTxnCommits;
00077 uint64_t dequeueTxnRejects;
00078 uint32_t dequeueTxnCount;
00079 uint32_t dequeueTxnCountHigh;
00080 uint32_t dequeueTxnCountLow;
00081 uint32_t consumers;
00082 uint32_t consumersHigh;
00083 uint32_t consumersLow;
00084 uint32_t bindings;
00085 uint32_t bindingsHigh;
00086 uint32_t bindingsLow;
00087 uint32_t unackedMessages;
00088 uint32_t unackedMessagesHigh;
00089 uint32_t unackedMessagesLow;
00090 uint64_t messageLatencyCount;
00091 uint64_t messageLatencyTotal;
00092 uint64_t messageLatencyMin;
00093 uint64_t messageLatencyMax;
00094
00095
00096 static void writeSchema (qpid::framing::Buffer& buf);
00097 void writeConfig (qpid::framing::Buffer& buf);
00098 void writeInstrumentation (qpid::framing::Buffer& buf,
00099 bool skipHeaders = false);
00100 void doMethod (std::string methodName,
00101 qpid::framing::Buffer& inBuf,
00102 qpid::framing::Buffer& outBuf);
00103 writeSchemaCall_t getWriteSchemaCall (void) { return writeSchema; }
00104
00105
00106 public:
00107
00108 friend class PackageQpid;
00109 typedef boost::shared_ptr<Queue> shared_ptr;
00110
00111 Queue (Manageable* coreObject, Manageable* _parent, std::string _name, uint8_t _durable, uint8_t _autoDelete, uint8_t _exclusive);
00112 ~Queue (void);
00113
00114 std::string getPackageName (void) { return packageName; }
00115 std::string getClassName (void) { return className; }
00116 uint8_t* getMd5Sum (void) { return md5Sum; }
00117
00118
00119 static const uint32_t METHOD_PURGE = 1;
00120
00121
00122 inline void set_arguments (framing::FieldTable val){
00123 sys::RWlock::ScopedWlock writeLock (accessLock);
00124 arguments = val;
00125 configChanged = true;
00126 }
00127 inline void set_storeRef (uint64_t val){
00128 sys::RWlock::ScopedWlock writeLock (accessLock);
00129 storeRef = val;
00130 configChanged = true;
00131 }
00132 inline void inc_msgTotalEnqueues (uint64_t by = 1){
00133 sys::RWlock::ScopedWlock writeLock (accessLock);
00134 msgTotalEnqueues += by;
00135 instChanged = true;
00136 }
00137 inline void dec_msgTotalEnqueues (uint64_t by = 1){
00138 sys::RWlock::ScopedWlock writeLock (accessLock);
00139 msgTotalEnqueues -= by;
00140 instChanged = true;
00141 }
00142 inline void inc_msgTotalDequeues (uint64_t by = 1){
00143 sys::RWlock::ScopedWlock writeLock (accessLock);
00144 msgTotalDequeues += by;
00145 instChanged = true;
00146 }
00147 inline void dec_msgTotalDequeues (uint64_t by = 1){
00148 sys::RWlock::ScopedWlock writeLock (accessLock);
00149 msgTotalDequeues -= by;
00150 instChanged = true;
00151 }
00152 inline void inc_msgTxnEnqueues (uint64_t by = 1){
00153 sys::RWlock::ScopedWlock writeLock (accessLock);
00154 msgTxnEnqueues += by;
00155 instChanged = true;
00156 }
00157 inline void dec_msgTxnEnqueues (uint64_t by = 1){
00158 sys::RWlock::ScopedWlock writeLock (accessLock);
00159 msgTxnEnqueues -= by;
00160 instChanged = true;
00161 }
00162 inline void inc_msgTxnDequeues (uint64_t by = 1){
00163 sys::RWlock::ScopedWlock writeLock (accessLock);
00164 msgTxnDequeues += by;
00165 instChanged = true;
00166 }
00167 inline void dec_msgTxnDequeues (uint64_t by = 1){
00168 sys::RWlock::ScopedWlock writeLock (accessLock);
00169 msgTxnDequeues -= by;
00170 instChanged = true;
00171 }
00172 inline void inc_msgPersistEnqueues (uint64_t by = 1){
00173 sys::RWlock::ScopedWlock writeLock (accessLock);
00174 msgPersistEnqueues += by;
00175 instChanged = true;
00176 }
00177 inline void dec_msgPersistEnqueues (uint64_t by = 1){
00178 sys::RWlock::ScopedWlock writeLock (accessLock);
00179 msgPersistEnqueues -= by;
00180 instChanged = true;
00181 }
00182 inline void inc_msgPersistDequeues (uint64_t by = 1){
00183 sys::RWlock::ScopedWlock writeLock (accessLock);
00184 msgPersistDequeues += by;
00185 instChanged = true;
00186 }
00187 inline void dec_msgPersistDequeues (uint64_t by = 1){
00188 sys::RWlock::ScopedWlock writeLock (accessLock);
00189 msgPersistDequeues -= by;
00190 instChanged = true;
00191 }
00192 inline void inc_msgDepth (uint32_t by = 1){
00193 sys::RWlock::ScopedWlock writeLock (accessLock);
00194 msgDepth += by;
00195 if (msgDepthHigh < msgDepth)
00196 msgDepthHigh = msgDepth;
00197 instChanged = true;
00198 }
00199 inline void dec_msgDepth (uint32_t by = 1){
00200 sys::RWlock::ScopedWlock writeLock (accessLock);
00201 msgDepth -= by;
00202 if (msgDepthLow > msgDepth)
00203 msgDepthLow = msgDepth;
00204 instChanged = true;
00205 }
00206 inline void inc_byteTotalEnqueues (uint64_t by = 1){
00207 sys::RWlock::ScopedWlock writeLock (accessLock);
00208 byteTotalEnqueues += by;
00209 instChanged = true;
00210 }
00211 inline void dec_byteTotalEnqueues (uint64_t by = 1){
00212 sys::RWlock::ScopedWlock writeLock (accessLock);
00213 byteTotalEnqueues -= by;
00214 instChanged = true;
00215 }
00216 inline void inc_byteTotalDequeues (uint64_t by = 1){
00217 sys::RWlock::ScopedWlock writeLock (accessLock);
00218 byteTotalDequeues += by;
00219 instChanged = true;
00220 }
00221 inline void dec_byteTotalDequeues (uint64_t by = 1){
00222 sys::RWlock::ScopedWlock writeLock (accessLock);
00223 byteTotalDequeues -= by;
00224 instChanged = true;
00225 }
00226 inline void inc_byteTxnEnqueues (uint64_t by = 1){
00227 sys::RWlock::ScopedWlock writeLock (accessLock);
00228 byteTxnEnqueues += by;
00229 instChanged = true;
00230 }
00231 inline void dec_byteTxnEnqueues (uint64_t by = 1){
00232 sys::RWlock::ScopedWlock writeLock (accessLock);
00233 byteTxnEnqueues -= by;
00234 instChanged = true;
00235 }
00236 inline void inc_byteTxnDequeues (uint64_t by = 1){
00237 sys::RWlock::ScopedWlock writeLock (accessLock);
00238 byteTxnDequeues += by;
00239 instChanged = true;
00240 }
00241 inline void dec_byteTxnDequeues (uint64_t by = 1){
00242 sys::RWlock::ScopedWlock writeLock (accessLock);
00243 byteTxnDequeues -= by;
00244 instChanged = true;
00245 }
00246 inline void inc_bytePersistEnqueues (uint64_t by = 1){
00247 sys::RWlock::ScopedWlock writeLock (accessLock);
00248 bytePersistEnqueues += by;
00249 instChanged = true;
00250 }
00251 inline void dec_bytePersistEnqueues (uint64_t by = 1){
00252 sys::RWlock::ScopedWlock writeLock (accessLock);
00253 bytePersistEnqueues -= by;
00254 instChanged = true;
00255 }
00256 inline void inc_bytePersistDequeues (uint64_t by = 1){
00257 sys::RWlock::ScopedWlock writeLock (accessLock);
00258 bytePersistDequeues += by;
00259 instChanged = true;
00260 }
00261 inline void dec_bytePersistDequeues (uint64_t by = 1){
00262 sys::RWlock::ScopedWlock writeLock (accessLock);
00263 bytePersistDequeues -= by;
00264 instChanged = true;
00265 }
00266 inline void inc_byteDepth (uint32_t by = 1){
00267 sys::RWlock::ScopedWlock writeLock (accessLock);
00268 byteDepth += by;
00269 if (byteDepthHigh < byteDepth)
00270 byteDepthHigh = byteDepth;
00271 instChanged = true;
00272 }
00273 inline void dec_byteDepth (uint32_t by = 1){
00274 sys::RWlock::ScopedWlock writeLock (accessLock);
00275 byteDepth -= by;
00276 if (byteDepthLow > byteDepth)
00277 byteDepthLow = byteDepth;
00278 instChanged = true;
00279 }
00280 inline void inc_enqueueTxnStarts (uint64_t by = 1){
00281 sys::RWlock::ScopedWlock writeLock (accessLock);
00282 enqueueTxnStarts += by;
00283 instChanged = true;
00284 }
00285 inline void dec_enqueueTxnStarts (uint64_t by = 1){
00286 sys::RWlock::ScopedWlock writeLock (accessLock);
00287 enqueueTxnStarts -= by;
00288 instChanged = true;
00289 }
00290 inline void inc_enqueueTxnCommits (uint64_t by = 1){
00291 sys::RWlock::ScopedWlock writeLock (accessLock);
00292 enqueueTxnCommits += by;
00293 instChanged = true;
00294 }
00295 inline void dec_enqueueTxnCommits (uint64_t by = 1){
00296 sys::RWlock::ScopedWlock writeLock (accessLock);
00297 enqueueTxnCommits -= by;
00298 instChanged = true;
00299 }
00300 inline void inc_enqueueTxnRejects (uint64_t by = 1){
00301 sys::RWlock::ScopedWlock writeLock (accessLock);
00302 enqueueTxnRejects += by;
00303 instChanged = true;
00304 }
00305 inline void dec_enqueueTxnRejects (uint64_t by = 1){
00306 sys::RWlock::ScopedWlock writeLock (accessLock);
00307 enqueueTxnRejects -= by;
00308 instChanged = true;
00309 }
00310 inline void inc_enqueueTxnCount (uint32_t by = 1){
00311 sys::RWlock::ScopedWlock writeLock (accessLock);
00312 enqueueTxnCount += by;
00313 if (enqueueTxnCountHigh < enqueueTxnCount)
00314 enqueueTxnCountHigh = enqueueTxnCount;
00315 instChanged = true;
00316 }
00317 inline void dec_enqueueTxnCount (uint32_t by = 1){
00318 sys::RWlock::ScopedWlock writeLock (accessLock);
00319 enqueueTxnCount -= by;
00320 if (enqueueTxnCountLow > enqueueTxnCount)
00321 enqueueTxnCountLow = enqueueTxnCount;
00322 instChanged = true;
00323 }
00324 inline void inc_dequeueTxnStarts (uint64_t by = 1){
00325 sys::RWlock::ScopedWlock writeLock (accessLock);
00326 dequeueTxnStarts += by;
00327 instChanged = true;
00328 }
00329 inline void dec_dequeueTxnStarts (uint64_t by = 1){
00330 sys::RWlock::ScopedWlock writeLock (accessLock);
00331 dequeueTxnStarts -= by;
00332 instChanged = true;
00333 }
00334 inline void inc_dequeueTxnCommits (uint64_t by = 1){
00335 sys::RWlock::ScopedWlock writeLock (accessLock);
00336 dequeueTxnCommits += by;
00337 instChanged = true;
00338 }
00339 inline void dec_dequeueTxnCommits (uint64_t by = 1){
00340 sys::RWlock::ScopedWlock writeLock (accessLock);
00341 dequeueTxnCommits -= by;
00342 instChanged = true;
00343 }
00344 inline void inc_dequeueTxnRejects (uint64_t by = 1){
00345 sys::RWlock::ScopedWlock writeLock (accessLock);
00346 dequeueTxnRejects += by;
00347 instChanged = true;
00348 }
00349 inline void dec_dequeueTxnRejects (uint64_t by = 1){
00350 sys::RWlock::ScopedWlock writeLock (accessLock);
00351 dequeueTxnRejects -= by;
00352 instChanged = true;
00353 }
00354 inline void inc_dequeueTxnCount (uint32_t by = 1){
00355 sys::RWlock::ScopedWlock writeLock (accessLock);
00356 dequeueTxnCount += by;
00357 if (dequeueTxnCountHigh < dequeueTxnCount)
00358 dequeueTxnCountHigh = dequeueTxnCount;
00359 instChanged = true;
00360 }
00361 inline void dec_dequeueTxnCount (uint32_t by = 1){
00362 sys::RWlock::ScopedWlock writeLock (accessLock);
00363 dequeueTxnCount -= by;
00364 if (dequeueTxnCountLow > dequeueTxnCount)
00365 dequeueTxnCountLow = dequeueTxnCount;
00366 instChanged = true;
00367 }
00368 inline void inc_consumers (uint32_t by = 1){
00369 sys::RWlock::ScopedWlock writeLock (accessLock);
00370 consumers += by;
00371 if (consumersHigh < consumers)
00372 consumersHigh = consumers;
00373 instChanged = true;
00374 }
00375 inline void dec_consumers (uint32_t by = 1){
00376 sys::RWlock::ScopedWlock writeLock (accessLock);
00377 consumers -= by;
00378 if (consumersLow > consumers)
00379 consumersLow = consumers;
00380 instChanged = true;
00381 }
00382 inline void inc_bindings (uint32_t by = 1){
00383 sys::RWlock::ScopedWlock writeLock (accessLock);
00384 bindings += by;
00385 if (bindingsHigh < bindings)
00386 bindingsHigh = bindings;
00387 instChanged = true;
00388 }
00389 inline void dec_bindings (uint32_t by = 1){
00390 sys::RWlock::ScopedWlock writeLock (accessLock);
00391 bindings -= by;
00392 if (bindingsLow > bindings)
00393 bindingsLow = bindings;
00394 instChanged = true;
00395 }
00396 inline void inc_unackedMessages (uint32_t by = 1){
00397 sys::RWlock::ScopedWlock writeLock (accessLock);
00398 unackedMessages += by;
00399 if (unackedMessagesHigh < unackedMessages)
00400 unackedMessagesHigh = unackedMessages;
00401 instChanged = true;
00402 }
00403 inline void dec_unackedMessages (uint32_t by = 1){
00404 sys::RWlock::ScopedWlock writeLock (accessLock);
00405 unackedMessages -= by;
00406 if (unackedMessagesLow > unackedMessages)
00407 unackedMessagesLow = unackedMessages;
00408 instChanged = true;
00409 }
00410 inline void set_messageLatency (uint64_t val){
00411 sys::RWlock::ScopedWlock writeLock (accessLock);
00412 messageLatencyCount++;
00413 messageLatencyTotal += val;
00414 if (messageLatencyMin > val)
00415 messageLatencyMin = val;
00416 if (messageLatencyMax < val)
00417 messageLatencyMax = val;
00418 instChanged = true;
00419 }
00420
00421 };
00422
00423 }}
00424
00425
00426 #endif