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/FieldTable.h"
00029 #include "qpid/framing/Uuid.h"
00030
00031 namespace qpid {
00032 namespace management {
00033
00034 class Queue : public ManagementObject
00035 {
00036 private:
00037
00038 static std::string packageName;
00039 static std::string className;
00040 static uint8_t md5Sum[16];
00041
00042
00043 uint64_t vhostRef;
00044 std::string name;
00045 uint8_t durable;
00046 uint8_t autoDelete;
00047 uint8_t exclusive;
00048 framing::FieldTable arguments;
00049 uint64_t storeRef;
00050
00051
00052 uint64_t msgTotalEnqueues;
00053 uint64_t msgTotalDequeues;
00054 uint64_t msgTxnEnqueues;
00055 uint64_t msgTxnDequeues;
00056 uint64_t msgPersistEnqueues;
00057 uint64_t msgPersistDequeues;
00058 uint32_t msgDepth;
00059 uint32_t msgDepthHigh;
00060 uint32_t msgDepthLow;
00061 uint64_t byteTotalEnqueues;
00062 uint64_t byteTotalDequeues;
00063 uint64_t byteTxnEnqueues;
00064 uint64_t byteTxnDequeues;
00065 uint64_t bytePersistEnqueues;
00066 uint64_t bytePersistDequeues;
00067 uint32_t byteDepth;
00068 uint32_t byteDepthHigh;
00069 uint32_t byteDepthLow;
00070 uint64_t enqueueTxnStarts;
00071 uint64_t enqueueTxnCommits;
00072 uint64_t enqueueTxnRejects;
00073 uint32_t enqueueTxnCount;
00074 uint32_t enqueueTxnCountHigh;
00075 uint32_t enqueueTxnCountLow;
00076 uint64_t dequeueTxnStarts;
00077 uint64_t dequeueTxnCommits;
00078 uint64_t dequeueTxnRejects;
00079 uint32_t dequeueTxnCount;
00080 uint32_t dequeueTxnCountHigh;
00081 uint32_t dequeueTxnCountLow;
00082 uint32_t consumers;
00083 uint32_t consumersHigh;
00084 uint32_t consumersLow;
00085 uint32_t bindings;
00086 uint32_t bindingsHigh;
00087 uint32_t bindingsLow;
00088 uint32_t unackedMessages;
00089 uint32_t unackedMessagesHigh;
00090 uint32_t unackedMessagesLow;
00091 uint64_t messageLatencyCount;
00092 uint64_t messageLatencyTotal;
00093 uint64_t messageLatencyMin;
00094 uint64_t messageLatencyMax;
00095
00096
00097 static void writeSchema (qpid::framing::Buffer& buf);
00098 void writeConfig (qpid::framing::Buffer& buf);
00099 void writeInstrumentation (qpid::framing::Buffer& buf,
00100 bool skipHeaders = false);
00101 void doMethod (std::string methodName,
00102 qpid::framing::Buffer& inBuf,
00103 qpid::framing::Buffer& outBuf);
00104 writeSchemaCall_t getWriteSchemaCall (void) { return writeSchema; }
00105
00106
00107 public:
00108
00109 friend class PackageQpid;
00110 typedef boost::shared_ptr<Queue> shared_ptr;
00111
00112 Queue (Manageable* coreObject, Manageable* _parent, std::string _name, uint8_t _durable, uint8_t _autoDelete, uint8_t _exclusive);
00113 ~Queue (void);
00114
00115 std::string getPackageName (void) { return packageName; }
00116 std::string getClassName (void) { return className; }
00117 uint8_t* getMd5Sum (void) { return md5Sum; }
00118
00119
00120 static const uint32_t METHOD_PURGE = 1;
00121
00122
00123 inline void set_arguments (framing::FieldTable val){
00124 sys::RWlock::ScopedWlock writeLock (accessLock);
00125 arguments = val;
00126 configChanged = true;
00127 }
00128 inline void set_storeRef (uint64_t val){
00129 sys::RWlock::ScopedWlock writeLock (accessLock);
00130 storeRef = val;
00131 configChanged = true;
00132 }
00133 inline void inc_msgTotalEnqueues (uint64_t by = 1){
00134 sys::RWlock::ScopedWlock writeLock (accessLock);
00135 msgTotalEnqueues += by;
00136 instChanged = true;
00137 }
00138 inline void dec_msgTotalEnqueues (uint64_t by = 1){
00139 sys::RWlock::ScopedWlock writeLock (accessLock);
00140 msgTotalEnqueues -= by;
00141 instChanged = true;
00142 }
00143 inline void set_msgTotalEnqueues (uint64_t val){
00144 sys::RWlock::ScopedWlock writeLock (accessLock);
00145 msgTotalEnqueues = val;
00146 instChanged = true;
00147 }
00148 inline void inc_msgTotalDequeues (uint64_t by = 1){
00149 sys::RWlock::ScopedWlock writeLock (accessLock);
00150 msgTotalDequeues += by;
00151 instChanged = true;
00152 }
00153 inline void dec_msgTotalDequeues (uint64_t by = 1){
00154 sys::RWlock::ScopedWlock writeLock (accessLock);
00155 msgTotalDequeues -= by;
00156 instChanged = true;
00157 }
00158 inline void set_msgTotalDequeues (uint64_t val){
00159 sys::RWlock::ScopedWlock writeLock (accessLock);
00160 msgTotalDequeues = val;
00161 instChanged = true;
00162 }
00163 inline void inc_msgTxnEnqueues (uint64_t by = 1){
00164 sys::RWlock::ScopedWlock writeLock (accessLock);
00165 msgTxnEnqueues += by;
00166 instChanged = true;
00167 }
00168 inline void dec_msgTxnEnqueues (uint64_t by = 1){
00169 sys::RWlock::ScopedWlock writeLock (accessLock);
00170 msgTxnEnqueues -= by;
00171 instChanged = true;
00172 }
00173 inline void set_msgTxnEnqueues (uint64_t val){
00174 sys::RWlock::ScopedWlock writeLock (accessLock);
00175 msgTxnEnqueues = val;
00176 instChanged = true;
00177 }
00178 inline void inc_msgTxnDequeues (uint64_t by = 1){
00179 sys::RWlock::ScopedWlock writeLock (accessLock);
00180 msgTxnDequeues += by;
00181 instChanged = true;
00182 }
00183 inline void dec_msgTxnDequeues (uint64_t by = 1){
00184 sys::RWlock::ScopedWlock writeLock (accessLock);
00185 msgTxnDequeues -= by;
00186 instChanged = true;
00187 }
00188 inline void set_msgTxnDequeues (uint64_t val){
00189 sys::RWlock::ScopedWlock writeLock (accessLock);
00190 msgTxnDequeues = val;
00191 instChanged = true;
00192 }
00193 inline void inc_msgPersistEnqueues (uint64_t by = 1){
00194 sys::RWlock::ScopedWlock writeLock (accessLock);
00195 msgPersistEnqueues += by;
00196 instChanged = true;
00197 }
00198 inline void dec_msgPersistEnqueues (uint64_t by = 1){
00199 sys::RWlock::ScopedWlock writeLock (accessLock);
00200 msgPersistEnqueues -= by;
00201 instChanged = true;
00202 }
00203 inline void set_msgPersistEnqueues (uint64_t val){
00204 sys::RWlock::ScopedWlock writeLock (accessLock);
00205 msgPersistEnqueues = val;
00206 instChanged = true;
00207 }
00208 inline void inc_msgPersistDequeues (uint64_t by = 1){
00209 sys::RWlock::ScopedWlock writeLock (accessLock);
00210 msgPersistDequeues += by;
00211 instChanged = true;
00212 }
00213 inline void dec_msgPersistDequeues (uint64_t by = 1){
00214 sys::RWlock::ScopedWlock writeLock (accessLock);
00215 msgPersistDequeues -= by;
00216 instChanged = true;
00217 }
00218 inline void set_msgPersistDequeues (uint64_t val){
00219 sys::RWlock::ScopedWlock writeLock (accessLock);
00220 msgPersistDequeues = val;
00221 instChanged = true;
00222 }
00223 inline void inc_msgDepth (uint32_t by = 1){
00224 sys::RWlock::ScopedWlock writeLock (accessLock);
00225 msgDepth += by;
00226 if (msgDepthHigh < msgDepth)
00227 msgDepthHigh = msgDepth;
00228 instChanged = true;
00229 }
00230 inline void dec_msgDepth (uint32_t by = 1){
00231 sys::RWlock::ScopedWlock writeLock (accessLock);
00232 msgDepth -= by;
00233 if (msgDepthLow > msgDepth)
00234 msgDepthLow = msgDepth;
00235 instChanged = true;
00236 }
00237 inline void set_msgDepth (uint32_t val){
00238 sys::RWlock::ScopedWlock writeLock (accessLock);
00239 msgDepth = val;
00240 if (msgDepthLow > val)
00241 msgDepthLow = val;
00242 if (msgDepthHigh < val)
00243 msgDepthHigh = val;
00244 instChanged = true;
00245 }
00246 inline void inc_byteTotalEnqueues (uint64_t by = 1){
00247 sys::RWlock::ScopedWlock writeLock (accessLock);
00248 byteTotalEnqueues += by;
00249 instChanged = true;
00250 }
00251 inline void dec_byteTotalEnqueues (uint64_t by = 1){
00252 sys::RWlock::ScopedWlock writeLock (accessLock);
00253 byteTotalEnqueues -= by;
00254 instChanged = true;
00255 }
00256 inline void set_byteTotalEnqueues (uint64_t val){
00257 sys::RWlock::ScopedWlock writeLock (accessLock);
00258 byteTotalEnqueues = val;
00259 instChanged = true;
00260 }
00261 inline void inc_byteTotalDequeues (uint64_t by = 1){
00262 sys::RWlock::ScopedWlock writeLock (accessLock);
00263 byteTotalDequeues += by;
00264 instChanged = true;
00265 }
00266 inline void dec_byteTotalDequeues (uint64_t by = 1){
00267 sys::RWlock::ScopedWlock writeLock (accessLock);
00268 byteTotalDequeues -= by;
00269 instChanged = true;
00270 }
00271 inline void set_byteTotalDequeues (uint64_t val){
00272 sys::RWlock::ScopedWlock writeLock (accessLock);
00273 byteTotalDequeues = val;
00274 instChanged = true;
00275 }
00276 inline void inc_byteTxnEnqueues (uint64_t by = 1){
00277 sys::RWlock::ScopedWlock writeLock (accessLock);
00278 byteTxnEnqueues += by;
00279 instChanged = true;
00280 }
00281 inline void dec_byteTxnEnqueues (uint64_t by = 1){
00282 sys::RWlock::ScopedWlock writeLock (accessLock);
00283 byteTxnEnqueues -= by;
00284 instChanged = true;
00285 }
00286 inline void set_byteTxnEnqueues (uint64_t val){
00287 sys::RWlock::ScopedWlock writeLock (accessLock);
00288 byteTxnEnqueues = val;
00289 instChanged = true;
00290 }
00291 inline void inc_byteTxnDequeues (uint64_t by = 1){
00292 sys::RWlock::ScopedWlock writeLock (accessLock);
00293 byteTxnDequeues += by;
00294 instChanged = true;
00295 }
00296 inline void dec_byteTxnDequeues (uint64_t by = 1){
00297 sys::RWlock::ScopedWlock writeLock (accessLock);
00298 byteTxnDequeues -= by;
00299 instChanged = true;
00300 }
00301 inline void set_byteTxnDequeues (uint64_t val){
00302 sys::RWlock::ScopedWlock writeLock (accessLock);
00303 byteTxnDequeues = val;
00304 instChanged = true;
00305 }
00306 inline void inc_bytePersistEnqueues (uint64_t by = 1){
00307 sys::RWlock::ScopedWlock writeLock (accessLock);
00308 bytePersistEnqueues += by;
00309 instChanged = true;
00310 }
00311 inline void dec_bytePersistEnqueues (uint64_t by = 1){
00312 sys::RWlock::ScopedWlock writeLock (accessLock);
00313 bytePersistEnqueues -= by;
00314 instChanged = true;
00315 }
00316 inline void set_bytePersistEnqueues (uint64_t val){
00317 sys::RWlock::ScopedWlock writeLock (accessLock);
00318 bytePersistEnqueues = val;
00319 instChanged = true;
00320 }
00321 inline void inc_bytePersistDequeues (uint64_t by = 1){
00322 sys::RWlock::ScopedWlock writeLock (accessLock);
00323 bytePersistDequeues += by;
00324 instChanged = true;
00325 }
00326 inline void dec_bytePersistDequeues (uint64_t by = 1){
00327 sys::RWlock::ScopedWlock writeLock (accessLock);
00328 bytePersistDequeues -= by;
00329 instChanged = true;
00330 }
00331 inline void set_bytePersistDequeues (uint64_t val){
00332 sys::RWlock::ScopedWlock writeLock (accessLock);
00333 bytePersistDequeues = val;
00334 instChanged = true;
00335 }
00336 inline void inc_byteDepth (uint32_t by = 1){
00337 sys::RWlock::ScopedWlock writeLock (accessLock);
00338 byteDepth += by;
00339 if (byteDepthHigh < byteDepth)
00340 byteDepthHigh = byteDepth;
00341 instChanged = true;
00342 }
00343 inline void dec_byteDepth (uint32_t by = 1){
00344 sys::RWlock::ScopedWlock writeLock (accessLock);
00345 byteDepth -= by;
00346 if (byteDepthLow > byteDepth)
00347 byteDepthLow = byteDepth;
00348 instChanged = true;
00349 }
00350 inline void set_byteDepth (uint32_t val){
00351 sys::RWlock::ScopedWlock writeLock (accessLock);
00352 byteDepth = val;
00353 if (byteDepthLow > val)
00354 byteDepthLow = val;
00355 if (byteDepthHigh < val)
00356 byteDepthHigh = val;
00357 instChanged = true;
00358 }
00359 inline void inc_enqueueTxnStarts (uint64_t by = 1){
00360 sys::RWlock::ScopedWlock writeLock (accessLock);
00361 enqueueTxnStarts += by;
00362 instChanged = true;
00363 }
00364 inline void dec_enqueueTxnStarts (uint64_t by = 1){
00365 sys::RWlock::ScopedWlock writeLock (accessLock);
00366 enqueueTxnStarts -= by;
00367 instChanged = true;
00368 }
00369 inline void set_enqueueTxnStarts (uint64_t val){
00370 sys::RWlock::ScopedWlock writeLock (accessLock);
00371 enqueueTxnStarts = val;
00372 instChanged = true;
00373 }
00374 inline void inc_enqueueTxnCommits (uint64_t by = 1){
00375 sys::RWlock::ScopedWlock writeLock (accessLock);
00376 enqueueTxnCommits += by;
00377 instChanged = true;
00378 }
00379 inline void dec_enqueueTxnCommits (uint64_t by = 1){
00380 sys::RWlock::ScopedWlock writeLock (accessLock);
00381 enqueueTxnCommits -= by;
00382 instChanged = true;
00383 }
00384 inline void set_enqueueTxnCommits (uint64_t val){
00385 sys::RWlock::ScopedWlock writeLock (accessLock);
00386 enqueueTxnCommits = val;
00387 instChanged = true;
00388 }
00389 inline void inc_enqueueTxnRejects (uint64_t by = 1){
00390 sys::RWlock::ScopedWlock writeLock (accessLock);
00391 enqueueTxnRejects += by;
00392 instChanged = true;
00393 }
00394 inline void dec_enqueueTxnRejects (uint64_t by = 1){
00395 sys::RWlock::ScopedWlock writeLock (accessLock);
00396 enqueueTxnRejects -= by;
00397 instChanged = true;
00398 }
00399 inline void set_enqueueTxnRejects (uint64_t val){
00400 sys::RWlock::ScopedWlock writeLock (accessLock);
00401 enqueueTxnRejects = val;
00402 instChanged = true;
00403 }
00404 inline void inc_enqueueTxnCount (uint32_t by = 1){
00405 sys::RWlock::ScopedWlock writeLock (accessLock);
00406 enqueueTxnCount += by;
00407 if (enqueueTxnCountHigh < enqueueTxnCount)
00408 enqueueTxnCountHigh = enqueueTxnCount;
00409 instChanged = true;
00410 }
00411 inline void dec_enqueueTxnCount (uint32_t by = 1){
00412 sys::RWlock::ScopedWlock writeLock (accessLock);
00413 enqueueTxnCount -= by;
00414 if (enqueueTxnCountLow > enqueueTxnCount)
00415 enqueueTxnCountLow = enqueueTxnCount;
00416 instChanged = true;
00417 }
00418 inline void set_enqueueTxnCount (uint32_t val){
00419 sys::RWlock::ScopedWlock writeLock (accessLock);
00420 enqueueTxnCount = val;
00421 if (enqueueTxnCountLow > val)
00422 enqueueTxnCountLow = val;
00423 if (enqueueTxnCountHigh < val)
00424 enqueueTxnCountHigh = val;
00425 instChanged = true;
00426 }
00427 inline void inc_dequeueTxnStarts (uint64_t by = 1){
00428 sys::RWlock::ScopedWlock writeLock (accessLock);
00429 dequeueTxnStarts += by;
00430 instChanged = true;
00431 }
00432 inline void dec_dequeueTxnStarts (uint64_t by = 1){
00433 sys::RWlock::ScopedWlock writeLock (accessLock);
00434 dequeueTxnStarts -= by;
00435 instChanged = true;
00436 }
00437 inline void set_dequeueTxnStarts (uint64_t val){
00438 sys::RWlock::ScopedWlock writeLock (accessLock);
00439 dequeueTxnStarts = val;
00440 instChanged = true;
00441 }
00442 inline void inc_dequeueTxnCommits (uint64_t by = 1){
00443 sys::RWlock::ScopedWlock writeLock (accessLock);
00444 dequeueTxnCommits += by;
00445 instChanged = true;
00446 }
00447 inline void dec_dequeueTxnCommits (uint64_t by = 1){
00448 sys::RWlock::ScopedWlock writeLock (accessLock);
00449 dequeueTxnCommits -= by;
00450 instChanged = true;
00451 }
00452 inline void set_dequeueTxnCommits (uint64_t val){
00453 sys::RWlock::ScopedWlock writeLock (accessLock);
00454 dequeueTxnCommits = val;
00455 instChanged = true;
00456 }
00457 inline void inc_dequeueTxnRejects (uint64_t by = 1){
00458 sys::RWlock::ScopedWlock writeLock (accessLock);
00459 dequeueTxnRejects += by;
00460 instChanged = true;
00461 }
00462 inline void dec_dequeueTxnRejects (uint64_t by = 1){
00463 sys::RWlock::ScopedWlock writeLock (accessLock);
00464 dequeueTxnRejects -= by;
00465 instChanged = true;
00466 }
00467 inline void set_dequeueTxnRejects (uint64_t val){
00468 sys::RWlock::ScopedWlock writeLock (accessLock);
00469 dequeueTxnRejects = val;
00470 instChanged = true;
00471 }
00472 inline void inc_dequeueTxnCount (uint32_t by = 1){
00473 sys::RWlock::ScopedWlock writeLock (accessLock);
00474 dequeueTxnCount += by;
00475 if (dequeueTxnCountHigh < dequeueTxnCount)
00476 dequeueTxnCountHigh = dequeueTxnCount;
00477 instChanged = true;
00478 }
00479 inline void dec_dequeueTxnCount (uint32_t by = 1){
00480 sys::RWlock::ScopedWlock writeLock (accessLock);
00481 dequeueTxnCount -= by;
00482 if (dequeueTxnCountLow > dequeueTxnCount)
00483 dequeueTxnCountLow = dequeueTxnCount;
00484 instChanged = true;
00485 }
00486 inline void set_dequeueTxnCount (uint32_t val){
00487 sys::RWlock::ScopedWlock writeLock (accessLock);
00488 dequeueTxnCount = val;
00489 if (dequeueTxnCountLow > val)
00490 dequeueTxnCountLow = val;
00491 if (dequeueTxnCountHigh < val)
00492 dequeueTxnCountHigh = val;
00493 instChanged = true;
00494 }
00495 inline void inc_consumers (uint32_t by = 1){
00496 sys::RWlock::ScopedWlock writeLock (accessLock);
00497 consumers += by;
00498 if (consumersHigh < consumers)
00499 consumersHigh = consumers;
00500 instChanged = true;
00501 }
00502 inline void dec_consumers (uint32_t by = 1){
00503 sys::RWlock::ScopedWlock writeLock (accessLock);
00504 consumers -= by;
00505 if (consumersLow > consumers)
00506 consumersLow = consumers;
00507 instChanged = true;
00508 }
00509 inline void set_consumers (uint32_t val){
00510 sys::RWlock::ScopedWlock writeLock (accessLock);
00511 consumers = val;
00512 if (consumersLow > val)
00513 consumersLow = val;
00514 if (consumersHigh < val)
00515 consumersHigh = val;
00516 instChanged = true;
00517 }
00518 inline void inc_bindings (uint32_t by = 1){
00519 sys::RWlock::ScopedWlock writeLock (accessLock);
00520 bindings += by;
00521 if (bindingsHigh < bindings)
00522 bindingsHigh = bindings;
00523 instChanged = true;
00524 }
00525 inline void dec_bindings (uint32_t by = 1){
00526 sys::RWlock::ScopedWlock writeLock (accessLock);
00527 bindings -= by;
00528 if (bindingsLow > bindings)
00529 bindingsLow = bindings;
00530 instChanged = true;
00531 }
00532 inline void set_bindings (uint32_t val){
00533 sys::RWlock::ScopedWlock writeLock (accessLock);
00534 bindings = val;
00535 if (bindingsLow > val)
00536 bindingsLow = val;
00537 if (bindingsHigh < val)
00538 bindingsHigh = val;
00539 instChanged = true;
00540 }
00541 inline void inc_unackedMessages (uint32_t by = 1){
00542 sys::RWlock::ScopedWlock writeLock (accessLock);
00543 unackedMessages += by;
00544 if (unackedMessagesHigh < unackedMessages)
00545 unackedMessagesHigh = unackedMessages;
00546 instChanged = true;
00547 }
00548 inline void dec_unackedMessages (uint32_t by = 1){
00549 sys::RWlock::ScopedWlock writeLock (accessLock);
00550 unackedMessages -= by;
00551 if (unackedMessagesLow > unackedMessages)
00552 unackedMessagesLow = unackedMessages;
00553 instChanged = true;
00554 }
00555 inline void set_unackedMessages (uint32_t val){
00556 sys::RWlock::ScopedWlock writeLock (accessLock);
00557 unackedMessages = val;
00558 if (unackedMessagesLow > val)
00559 unackedMessagesLow = val;
00560 if (unackedMessagesHigh < val)
00561 unackedMessagesHigh = val;
00562 instChanged = true;
00563 }
00564 inline void set_messageLatency (uint64_t val){
00565 sys::RWlock::ScopedWlock writeLock (accessLock);
00566 messageLatencyCount++;
00567 messageLatencyTotal += val;
00568 if (messageLatencyMin > val)
00569 messageLatencyMin = val;
00570 if (messageLatencyMax < val)
00571 messageLatencyMax = val;
00572 instChanged = true;
00573 }
00574
00575 };
00576
00577 }}
00578
00579
00580 #endif