activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r737520 - in /activemq/activemq-cpp/trunk/src/main/activemq: core/ transport/ transport/failover/
Date Sun, 25 Jan 2009 15:17:13 GMT
Author: tabish
Date: Sun Jan 25 15:17:13 2009
New Revision: 737520

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

More work on the Failover bits.

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionSupport.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportExceptionListener.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h
    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.h

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionSupport.h?rev=737520&r1=737519&r2=737520&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionSupport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionSupport.h Sun Jan
25 15:17:13 2009
@@ -352,6 +352,16 @@
             return this->tempDestinationIds.getNextSequenceId();
         }
 
+        /**
+         * The transport has suffered an interruption from which it hopes to recover
+         */
+        virtual void transportInterrupted() {}
+
+        /**
+         * The transport has resumed after an interruption
+         */
+        virtual void transportResumed() {}
+
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportExceptionListener.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportExceptionListener.h?rev=737520&r1=737519&r2=737520&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportExceptionListener.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportExceptionListener.h Sun
Jan 25 15:17:13 2009
@@ -40,9 +40,18 @@
          * @param source The source of the exception
          * @param ex The exception.
          */
-        virtual void onTransportException(
-            Transport* source,
-            const decaf::lang::Exception& ex ) = 0;
+        virtual void onTransportException( Transport* source,
+                                           const decaf::lang::Exception& ex ) = 0;
+
+        /**
+         * The transport has suffered an interruption from which it hopes to recover
+         */
+        virtual void transportInterrupted() = 0;
+
+        /**
+         * The transport has resumed after an interruption
+         */
+        virtual void transportResumed() = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h?rev=737520&r1=737519&r2=737520&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportFilter.h Sun Jan 25 15:17:13
2009
@@ -117,6 +117,16 @@
                                            const decaf::lang::Exception& ex );
 
         /**
+         * The transport has suffered an interruption from which it hopes to recover
+         */
+        virtual void transportInterrupted() {}
+
+        /**
+         * The transport has resumed after an interruption
+         */
+        virtual void transportResumed() {}
+
+        /**
          * Sends a one-way command.  Does not wait for any response from the
          * broker.
          * @param command the command to be sent.

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=737520&r1=737519&r2=737520&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 Sun
Jan 25 15:17:13 2009
@@ -22,9 +22,28 @@
 using namespace activemq::transport::failover;
 
 ////////////////////////////////////////////////////////////////////////////////
-BackupTransport::BackupTransport() {
+BackupTransport::BackupTransport( FailoverTransport* failover ) {
+
+    this->failover = failover;
+    this->transport = NULL;
+    this->disposed = false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 BackupTransport::~BackupTransport() {
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void BackupTransport::onTransportException( transport::Transport* source,
+                                            const decaf::lang::Exception& ex ) {
+
+    this->disposed = true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void BackupTransport::transportInterrupted() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void BackupTransport::transportResumed() {
+}

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=737520&r1=737519&r2=737520&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 Sun
Jan 25 15:17:13 2009
@@ -21,6 +21,8 @@
 #include <activemq/util/Config.h>
 
 #include <activemq/transport/Transport.h>
+#include <activemq/transport/TransportExceptionListener.h>
+#include <decaf/net/URI.h>
 
 namespace activemq {
 namespace transport {
@@ -28,7 +30,7 @@
 
     class FailoverTransport;
 
-    class AMQCPP_API BackupTransport {
+    class AMQCPP_API BackupTransport : public TransportExceptionListener {
     private:
 
         // The parent Failover Transport
@@ -37,11 +39,73 @@
         // The Transport this one is managing.
         Transport* transport;
 
+        // The URI of this Backup
+        URI uri;
+
+        // Indicates that the contained transport is not valid any longer.
+        bool disposed;
+
     public:
 
-        BackupTransport();
+        BackupTransport( FailoverTransport* failover );
         virtual ~BackupTransport();
 
+        /**
+         * Gets the URI assigned to this Backup
+         * @return the assigned URI
+         */
+        URI getURI() const {
+            return this->uri;
+        }
+
+        /**
+         * Sets the URI assigned to this Transport.
+         */
+        void setURI( const URI& uri ) {
+            this->uri = uri;
+        }
+
+        /**
+         * Gets the currently held transport
+         * @returns pointer to the held transport or NULL if not set.
+         */
+        Transport* getTransport() {
+            return transport;
+        }
+
+        /**
+         * Sets the held transport, if not NULL then start to listen for exceptions
+         * from the held transport.
+         *
+         * @param transport
+         *        The transport to hold.
+         */
+        void setTransport( Transport* transport ) {
+            this->transport = transport;
+
+            if( this->transport != NULL ) {
+                this->transport->setTransportExceptionListener( this );
+            }
+        }
+
+        /**
+         * Event handler for an exception from a command transport.
+         * @param source The source of the exception
+         * @param ex The exception.
+         */
+        virtual void onTransportException( transport::Transport* source,
+                                           const decaf::lang::Exception& ex );
+
+        /**
+         * The transport has suffered an interruption from which it hopes to recover
+         */
+        virtual void transportInterrupted();
+
+        /**
+         * The transport has resumed after an interruption
+         */
+        virtual void transportResumed();
+
     };
 
 }}}

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=737520&r1=737519&r2=737520&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 Sun
Jan 25 15:17:13 2009
@@ -20,7 +20,7 @@
 
 #include <activemq/util/Config.h>
 
-#include <activemq/transport/TransportFilter.h>
+#include <activemq/transport/CompositeTransport.h>
 
 namespace activemq {
 namespace transport {
@@ -28,7 +28,7 @@
 
     class BackupTransport;
 
-    class AMQCPP_API FailoverTransport : public TransportFilter {
+    class AMQCPP_API FailoverTransport : public CompositeTransport {
     public:
 
         FailoverTransport();



Mime
View raw message