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 2013/02/14 15:31:58 UTC

svn commit: r1446203 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels: ActiveMQConsumerKernel.cpp ActiveMQProducerKernel.cpp ActiveMQSessionKernel.cpp

Author: tabish
Date: Thu Feb 14 14:31:57 2013
New Revision: 1446203

URL: http://svn.apache.org/r1446203
Log:
Some cleanups

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp?rev=1446203&r1=1446202&r2=1446203&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp Thu Feb 14 14:31:57 2013
@@ -333,13 +333,15 @@ ActiveMQConsumerKernel::ActiveMQConsumer
         std::string connectionId = session->getConnection()->getConnectionInfo().getConnectionId()->getValue();
 
         if (physicalName.find(connectionId) == std::string::npos) {
-            throw cms::InvalidDestinationException("Cannot use a Temporary destination from another Connection");
+            throw cms::InvalidDestinationException(
+                "Cannot use a Temporary destination from another Connection");
         }
 
         Pointer<ActiveMQTempDestination> tempDest = destination.dynamicCast<ActiveMQTempDestination>();
 
         if (session->getConnection()->isDeleted(tempDest)) {
-            throw cms::InvalidDestinationException("Cannot use a Temporary destination that has been deleted");
+            throw cms::InvalidDestinationException(
+                "Cannot use a Temporary destination that has been deleted");
         }
     }
 
@@ -385,7 +387,8 @@ ActiveMQConsumerKernel::ActiveMQConsumer
 
     if (this->consumerInfo->getPrefetchSize() < 0) {
         delete this->internal;
-        throw IllegalArgumentException(__FILE__, __LINE__, "Cannot create a consumer with a negative prefetch");
+        throw IllegalArgumentException(
+            __FILE__, __LINE__, "Cannot create a consumer with a negative prefetch");
     }
 }
 
@@ -461,9 +464,9 @@ void ActiveMQConsumerKernel::doClose() {
         info->setLastDeliveredSequenceId(this->internal->lastDeliveredSequenceId);
         this->session->oneway(info);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -486,7 +489,7 @@ void ActiveMQConsumerKernel::dispose() {
             // Purge all the pending messages
             try{
                 this->internal->unconsumedMessages->clear();
-            } catch ( ActiveMQException& ex ){
+            } catch (ActiveMQException& ex){
                 if( !haveException ){
                     ex.setMark( __FILE__, __LINE__ );
                     error = ex;
@@ -527,9 +530,9 @@ void ActiveMQConsumerKernel::dispose() {
             }
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -784,9 +787,9 @@ void ActiveMQConsumerKernel::afterMessag
             throw IllegalStateException( __FILE__, __LINE__, "Invalid Session State" );
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -828,9 +831,9 @@ void ActiveMQConsumerKernel::deliverAcks
             }
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1122,9 +1125,9 @@ void ActiveMQConsumerKernel::dispatch(co
             }
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1170,10 +1173,10 @@ Pointer<cms::Message> ActiveMQConsumerKe
 
         return message.dynamicCast<cms::Message>();
     }
-    AMQ_CATCH_RETHROW( cms::CMSException )
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(cms::CMSException)
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1198,9 +1201,9 @@ void ActiveMQConsumerKernel::sendPullReq
             this->session->oneway(messagePull);
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp?rev=1446203&r1=1446202&r2=1446203&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp Thu Feb 14 14:31:57 2013
@@ -280,9 +280,9 @@ void ActiveMQProducerKernel::onProducerA
             this->memoryUsage->decreaseUsage(ack.getSize());
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp?rev=1446203&r1=1446202&r2=1446203&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp Thu Feb 14 14:31:57 2013
@@ -267,7 +267,7 @@ ActiveMQSessionKernel::~ActiveMQSessionK
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSessionKernel::fire(const activemq::exceptions::ActiveMQException& ex) {
+void ActiveMQSessionKernel::fire(const ActiveMQException& ex) {
     if (connection != NULL) {
         connection->fire(ex);
     }
@@ -307,9 +307,9 @@ void ActiveMQSessionKernel::doClose() {
         info->setLastDeliveredSequenceId(this->lastDeliveredSequenceId);
         this->connection->oneway(info);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -408,9 +408,9 @@ void ActiveMQSessionKernel::dispose() {
             throw;
         }
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -590,7 +590,7 @@ cms::MessageConsumer* ActiveMQSessionKer
             this->connection->syncRequest(consumer->getConsumerInfo());
         } catch (Exception& ex) {
             this->removeConsumer(consumer);
-            throw ex;
+            throw;
         }
 
         consumer->setMessageTransformer(this->config->transformer);
@@ -634,7 +634,7 @@ cms::MessageConsumer* ActiveMQSessionKer
             this->connection->syncRequest(consumer->getConsumerInfo());
         } catch (Exception& ex) {
             this->removeConsumer(consumer);
-            throw ex;
+            throw;
         }
 
         consumer->setMessageTransformer(this->config->transformer);
@@ -684,7 +684,7 @@ cms::MessageProducer* ActiveMQSessionKer
             this->connection->oneway(producer->getProducerInfo());
         } catch (Exception& ex) {
             this->removeProducer(producer);
-            throw ex;
+            throw;
         }
 
         producer->setMessageTransformer(this->config->transformer);
@@ -1118,9 +1118,9 @@ void ActiveMQSessionKernel::createTempor
         tempDestination->setConnection(this->connection);
         this->connection->addTempDestination(Pointer<ActiveMQTempDestination>(tempDestination->cloneDataStructure()));
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1161,9 +1161,9 @@ void ActiveMQSessionKernel::destroyTempo
         // Send the message to the broker.
         this->connection->syncRequest(command);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1173,9 +1173,9 @@ std::string ActiveMQSessionKernel::creat
         return this->connection->getConnectionId().getValue() + ":" +
                Long::toString(this->connection->getNextTempDestinationId());
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1184,9 +1184,9 @@ void ActiveMQSessionKernel::oneway(Point
     try {
         this->connection->oneway(command);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1196,9 +1196,9 @@ Pointer<Response> ActiveMQSessionKernel:
         this->checkClosed();
         return this->connection->syncRequest(command, timeout);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1227,9 +1227,9 @@ void ActiveMQSessionKernel::addConsumer(
         // Register this as a message dispatcher for the consumer.
         this->connection->addDispatcher(consumer->getConsumerInfo()->getConsumerId(), this);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1246,9 +1246,9 @@ void ActiveMQSessionKernel::removeConsum
             throw;
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1268,9 +1268,9 @@ void ActiveMQSessionKernel::addProducer(
 
         this->connection->addProducer(producer);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1287,9 +1287,9 @@ void ActiveMQSessionKernel::removeProduc
             throw;
         }
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    AMQ_CATCH_RETHROW(ActiveMQException)
+    AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+    AMQ_CATCHALL_THROW(ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////