You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/04/04 23:03:53 UTC

svn commit: r1088791 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/library/ActiveMQCPP.cpp

Author: tabish
Date: Mon Apr  4 21:03:53 2011
New Revision: 1088791

URL: http://svn.apache.org/viewvc?rev=1088791&view=rev
Log:
Do a manual unregister of WireFormat and Transport factories on library shutdown instead of letting the registery destructor handle it, this prevents leak checkers like valgrind from mistakenly reporting memory leaks.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/library/ActiveMQCPP.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/library/ActiveMQCPP.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/library/ActiveMQCPP.cpp?rev=1088791&r1=1088790&r2=1088791&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/library/ActiveMQCPP.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/library/ActiveMQCPP.cpp Mon Apr  4 21:03:53 2011
@@ -67,6 +67,16 @@ void ActiveMQCPP::shutdownLibrary() {
     // Shutdown the IdGenerator Kernel
     IdGenerator::shutdown();
 
+    // Clear out all registered WireFormat Factories.
+    WireFormatRegistry::getInstance().unregisterFactory("openwire");
+    WireFormatRegistry::getInstance().unregisterFactory("stomp");
+
+    // Clear out all regsitered Transport factories
+    TransportRegistry::getInstance().unregisterFactory("tcp");
+    TransportRegistry::getInstance().unregisterFactory("ssl");
+    TransportRegistry::getInstance().unregisterFactory("mock");
+    TransportRegistry::getInstance().unregisterFactory("failover");
+
     // Now it should be safe to shutdown Decaf.
     decaf::lang::Runtime::shutdownRuntime();
 }