qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r801860 - in /qpid/trunk/qpid/cpp/src/qpid/broker: LinkRegistry.cpp LinkRegistry.h
Date Fri, 07 Aug 2009 01:53:50 GMT
Author: astitcher
Date: Fri Aug  7 01:53:50 2009
New Revision: 801860

URL: http://svn.apache.org/viewvc?rev=801860&view=rev
Log:
Change LinkRegistry to cancel its TimerTask in its destructor

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.cpp?rev=801860&r1=801859&r2=801860&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.cpp Fri Aug  7 01:53:50 2009
@@ -49,10 +49,16 @@
 
 LinkRegistry::LinkRegistry (Broker* _broker) :
     broker(_broker), timer(&broker->getTimer()),
+    maintenanceTask(new Periodic(*this)),
     parent(0), store(0), passive(false), passiveChanged(false),
     realm(broker->getOptions().realm)
 {
-    timer->add (new Periodic(*this));
+    timer->add(maintenanceTask);
+}
+
+LinkRegistry::~LinkRegistry()
+{
+    maintenanceTask->cancel();
 }
 
 LinkRegistry::Periodic::Periodic (LinkRegistry& _links) :
@@ -61,7 +67,8 @@
 void LinkRegistry::Periodic::fire ()
 {
     links.periodicMaintenance ();
-    links.timer->add (new Periodic(links));
+    setupNextFire();
+    links.timer->add (this);
 }
 
 void LinkRegistry::periodicMaintenance ()

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.h?rev=801860&r1=801859&r2=801860&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/LinkRegistry.h Fri Aug  7 01:53:50 2009
@@ -30,6 +30,7 @@
 #include "qpid/sys/Timer.h"
 #include "qpid/management/Manageable.h"
 #include <boost/shared_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
 
 namespace qpid {
 namespace broker {
@@ -63,6 +64,7 @@
         qpid::sys::Mutex lock;
         Broker* broker;
         sys::Timer* timer;
+        boost::intrusive_ptr<qpid::sys::TimerTask> maintenanceTask;
         management::Manageable* parent;
         MessageStore* store;
         bool passive;
@@ -77,6 +79,8 @@
     public:
         LinkRegistry (); // Only used in store tests
         LinkRegistry (Broker* _broker);
+        ~LinkRegistry();
+
         std::pair<boost::shared_ptr<Link>, bool>
             declare(std::string& host,
                     uint16_t     port,



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message