activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r511624 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire: OpenWireFormatNegotiator.cpp OpenWireFormatNegotiator.h
Date Sun, 25 Feb 2007 21:31:14 GMT
Author: tabish
Date: Sun Feb 25 13:31:14 2007
New Revision: 511624

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

Refactored the Prefered WireFormat info setup code, so that we can
get tight encoding working.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.cpp?view=diff&rev=511624&r1=511623&r2=511624
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.cpp
Sun Feb 25 13:31:14 2007
@@ -51,8 +51,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void OpenWireFormatNegotiator::oneway( Command* command )
-    throw( CommandIOException, exceptions::UnsupportedOperationException )
-{
+    throw( CommandIOException, exceptions::UnsupportedOperationException ) {
 
     try{
 
@@ -80,8 +79,37 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+Response* OpenWireFormatNegotiator::request( Command* command )
+    throw( CommandIOException, exceptions::UnsupportedOperationException ) {
+
+    try{
+
+        if( closed || next == NULL ){
+            throw CommandIOException(
+                __FILE__, __LINE__,
+                "OpenWireFormatNegotiator::request - transport already closed" );
+        }
+
+        if( !readyCountDownLatch.await( negotiationTimeout ) ) {
+            throw CommandIOException(
+                __FILE__,
+                __LINE__,
+                "OpenWireFormatNegotiator::request"
+                "Wire format negociation timeout: peer did not "
+                "send his wire format." );
+        }
+
+        return next->request( command );
+    }
+    AMQ_CATCH_RETHROW( exceptions::UnsupportedOperationException )
+    AMQ_CATCH_RETHROW( CommandIOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, CommandIOException )
+    AMQ_CATCHALL_THROW( CommandIOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void OpenWireFormatNegotiator::onCommand( Command* command ) {
-    
+
     DataStructure* dataStructure =
         dynamic_cast<DataStructure*>( command );
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.h?view=diff&rev=511624&r1=511623&r2=511624
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireFormatNegotiator.h
Sun Feb 25 13:31:14 2007
@@ -76,6 +76,8 @@
         /**
          * Sends a one-way command.  Does not wait for any response from the
          * broker.
+         * First waits for the WireFormatInfo exchange to happen so that we
+         * know how to encode outbound data.
          * @param command the command to be sent.
          * @throws CommandIOException if an exception occurs during writing of
          * the command.
@@ -83,6 +85,17 @@
          * by this transport.
          */
         virtual void oneway( transport::Command* command )
+            throw( transport::CommandIOException, exceptions::UnsupportedOperationException
);
+
+        /**
+         * Sends the given request to the server and waits for the response.
+         * First waits for the WireFormatInfo exchange to happen so that we
+         * know how to encode outbound data.
+         * @param command The request to send.
+         * @return the response from the server.
+         * @throws CommandIOException if an error occurs with the request.
+         */
+        virtual transport::Response* request( transport::Command* command )
             throw( transport::CommandIOException, exceptions::UnsupportedOperationException
);
 
         /**



Mime
View raw message