activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r688574 - in /activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire: OpenWireConnector.cpp OpenWireConnector.h
Date Sun, 24 Aug 2008 23:21:18 GMT
Author: tabish
Date: Sun Aug 24 16:21:18 2008
New Revision: 688574

URL: http://svn.apache.org/viewvc?rev=688574&view=rev
Log:
Implement timed sync request to remove the connection.

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

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp?rev=688574&r1=688573&r2=688574&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
Sun Aug 24 16:21:18 2008
@@ -237,7 +237,7 @@
         }
 
         // Remove our ConnectionId from the Broker
-        disposeOf( connectionInfo.getConnectionId() );
+        disposeOf( connectionInfo.getConnectionId(), this->getCloseTimeout() );
 
         // Send the disconnect command to the broker.
         commands::ShutdownInfo shutdown;
@@ -1577,6 +1577,21 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void OpenWireConnector::disposeOf( commands::DataStructure* objectId,
+                                   unsigned int timeout )
+    throw ( ConnectorException ) {
+
+    try{
+        commands::RemoveInfo command;
+        command.setObjectId( objectId->cloneDataStructure() );
+        delete this->syncRequest( &command, timeout );
+    }
+    AMQ_CATCH_RETHROW( ConnectorException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, OpenWireConnectorException )
+    AMQ_CATCHALL_THROW( OpenWireConnectorException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void OpenWireConnector::createTemporaryDestination(
     commands::ActiveMQTempDestination* tempDestination ) throw ( ConnectorException ) {
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.h?rev=688574&r1=688573&r2=688574&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.h Sun
Aug 24 16:21:18 2008
@@ -639,6 +639,15 @@
                         core::ActiveMQConstants::PARAM_SENDTIMEOUT ), "0" ) );
         }
 
+        // Gets the time to wait for a response from the Broker when the close message
+        // is sent.
+        virtual unsigned int getCloseTimeout() const {
+            return decaf::lang::Integer::parseInt(
+                properties.getProperty(
+                    core::ActiveMQConstants::toString(
+                        core::ActiveMQConstants::PARAM_CLOSETIMEOUT ), "15000" ) );
+        }
+
         // Check for Connected State and Throw an exception if not.
         void enforceConnected() throw ( ConnectorException );
 
@@ -663,7 +672,8 @@
             throw (ConnectorException);
 
         /**
-         * Sends a message to the broker to dispose of the given resource.
+         * Sends a message to the broker to dispose of the given resource
+         * using an async oneway call.
          * @param objectId The ID of the resource to be released.
          * @throw ConnectorException if any problems occur from sending
          * the message.
@@ -672,6 +682,17 @@
             throw ( ConnectorException );
 
         /**
+         * Sends a message to the broker to dispose of the given resource
+         * using a timed request.
+         * @param objectId The ID of the resource to be released.
+         * @param timeout The time to wait for a response that the object is disposed.
+         * @throw ConnectorException if any problems occur from sending
+         * the message.
+         */
+        void disposeOf( commands::DataStructure* objectId, unsigned int timeout )
+            throw ( ConnectorException );
+
+        /**
          * Send the Destination Creation Request to the Broker, alerting it
          * that we've created a new Temporary Destination.
          * @param tempDestination - The new Temporary Destination



Mime
View raw message