activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r750146 - in /activemq/activemq-cpp/trunk/src/main/activemq/transport/failover: BackupTransport.cpp BackupTransport.h FailoverTransport.cpp FailoverTransport.h FailoverTransportFactory.cpp ReconnectTask.cpp
Date Wed, 04 Mar 2009 20:37:54 GMT
Author: tabish
Date: Wed Mar  4 20:37:53 2009
New Revision: 750146

URL: http://svn.apache.org/viewvc?rev=750146&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-100

Fix a bunch of errors in the code that result in segfaults.

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportFactory.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/ReconnectTask.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.cpp?rev=750146&r1=750145&r2=750146&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.cpp Wed
Mar  4 20:37:53 2009
@@ -34,8 +34,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BackupTransport::onTransportException( transport::Transport* source,
-                                            const decaf::lang::Exception& ex ) {
+void BackupTransport::onException( const decaf::lang::Exception& ex AMQCPP_UNUSED ) {
 
     this->closed = true;
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.h?rev=750146&r1=750145&r2=750146&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/BackupTransport.h Wed
Mar  4 20:37:53 2009
@@ -98,8 +98,7 @@
          * @param source The source of the exception
          * @param ex The exception.
          */
-        virtual void onTransportException( transport::Transport* source,
-                                           const decaf::lang::Exception& ex );
+        virtual void onException( const decaf::lang::Exception& ex );
 
         /**
          * Has the Transport been shutdown and no longer usable.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=750146&r1=750145&r2=750146&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
Wed Mar  4 20:37:53 2009
@@ -40,8 +40,9 @@
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-FailoverTransport::FailoverTransport() {
+FailoverTransport::FailoverTransport( const Pointer<wireformat::WireFormat>& wireFormat
) {
 
+    this->wireFormat = wireFormat;
     this->timeout = -1;
     this->initialReconnectDelay = 10;
     this->maxReconnectDelay = 1000 * 30;
@@ -58,6 +59,7 @@
     this->trackMessages = false;
     this->maxCacheSize = 128 * 1024;
 
+    this->stateTracker.setTrackTransactions( true );
     this->myTransportListener.reset( new FailoverTransportListener( this ) );
     this->reconnectTask.reset( new ReconnectTask( this ) );
 }
@@ -134,6 +136,23 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void FailoverTransport::reconnect( const decaf::net::URI& uri )
+    throw( decaf::io::IOException ) {
+
+    try {
+
+        if( !uris.contains( uri ) ) {
+            uris.add( uri );
+        }
+
+        reconnect();
+    }
+    AMQ_CATCH_RETHROW( IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+    AMQ_CATCHALL_THROW( IOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
 StlList<URI> FailoverTransport::getConnectList() const {
 
     StlList<URI> result( uris );
@@ -424,7 +443,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void FailoverTransport::handleTransportFailure( const decaf::lang::Exception& error )
+void FailoverTransport::handleTransportFailure( const decaf::lang::Exception& error AMQCPP_UNUSED
)
     throw( decaf::lang::Exception ) {
 
     Pointer<Transport> transport;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h?rev=750146&r1=750145&r2=750146&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h Wed
Mar  4 20:37:53 2009
@@ -26,6 +26,7 @@
 #include <activemq/transport/failover/BackupTransport.h>
 #include <activemq/transport/failover/ReconnectTask.h>
 #include <activemq/transport/failover/FailoverTransportListener.h>
+#include <activemq/wireformat/WireFormat.h>
 
 #include <decaf/util/StlList.h>
 #include <decaf/util/StlMap.h>
@@ -82,6 +83,7 @@
         decaf::util::concurrent::Mutex listenerMutex;
         decaf::util::StlMap<int, Pointer<Command> > requestMap;
 
+        Pointer<wireformat::WireFormat> wireFormat;
         Pointer<URI> connectedTransportURI;
         Pointer<URI> failedConnectTransportURI;
         Pointer<Transport> connectedTransport;
@@ -93,7 +95,7 @@
 
     public:
 
-        FailoverTransport();
+        FailoverTransport( const Pointer<wireformat::WireFormat>& wireFormat );
 
         virtual ~FailoverTransport();
 
@@ -197,7 +199,9 @@
          * Sets the WireFormat instance to use.
          * @param WireFormat the object used to encode / decode commands.
          */
-        virtual void setWireFormat( const Pointer<wireformat::WireFormat>& wireFormat
) {}
+        virtual void setWireFormat( const Pointer<wireformat::WireFormat>& wireFormat
) {
+            this->wireFormat = wireFormat;
+        }
 
         /**
          * Sets the observer of asynchronous events from this transport.
@@ -261,7 +265,7 @@
          * @throws IOException on failure of if not supported
          */
         virtual void reconnect( const decaf::net::URI& uri )
-            throw( decaf::io::IOException ) {}
+            throw( decaf::io::IOException );
 
     public: // FailoverTransport Property Getters / Setters
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportFactory.cpp?rev=750146&r1=750145&r2=750146&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportFactory.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportFactory.cpp
Wed Mar  4 20:37:53 2009
@@ -45,7 +45,7 @@
     try {
 
         CompositeData data = URISupport::parseComposite( location );
-        Pointer<FailoverTransport> transport( new FailoverTransport() );
+        Pointer<FailoverTransport> transport( new FailoverTransport( wireFormat ) );
 
         transport->setInitialReconnectDelay(
             Long::parseLong( properties.getProperty( "initialReconnectDelay", "10" ) ) );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/ReconnectTask.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/ReconnectTask.cpp?rev=750146&r1=750145&r2=750146&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/ReconnectTask.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/ReconnectTask.cpp Wed
Mar  4 20:37:53 2009
@@ -41,7 +41,7 @@
     this->pending = false;
     this->shutDown = false;
 
-    this->start();
+    //this->start();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -85,7 +85,6 @@
 
     bool result = false;
     bool buildBackup = true;
-    bool doReconnect = !parent->closed;
 
     synchronized( &( parent->backupMutex ) ) {
         if( parent->connectedTransport == NULL && !parent->closed ) {



Mime
View raw message