activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq-cpp git commit: Clean up a bit
Date Thu, 30 Jul 2015 15:37:41 GMT
Repository: activemq-cpp
Updated Branches:
  refs/heads/master b8564c672 -> ace7a74cc


Clean up a bit

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/ace7a74c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/ace7a74c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/ace7a74c

Branch: refs/heads/master
Commit: ace7a74cc046c1d3705555053cc11320a814a0cc
Parents: b8564c6
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu Jul 30 11:37:26 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu Jul 30 11:37:26 2015 -0400

----------------------------------------------------------------------
 .../activemq/util/CMSListener.cpp               | 34 ++++----
 .../activemq/util/CMSListener.h                 |  8 +-
 .../activemq/util/CMSProvider.cpp               | 84 ++++++++++----------
 3 files changed, 60 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/ace7a74c/activemq-cpp/src/test-integration/activemq/util/CMSListener.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/util/CMSListener.cpp b/activemq-cpp/src/test-integration/activemq/util/CMSListener.cpp
index 126b64c..af91d8e 100644
--- a/activemq-cpp/src/test-integration/activemq/util/CMSListener.cpp
+++ b/activemq-cpp/src/test-integration/activemq/util/CMSListener.cpp
@@ -43,42 +43,41 @@ void CMSListener::reset() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void CMSListener::asyncWaitForMessages( unsigned int count ) {
+void CMSListener::asyncWaitForMessages(unsigned int count) {
 
     try {
 
         synchronized( &mutex ) {
             int stopAtZero = count + 5;
 
-            while( numReceived < count ) {
-                mutex.wait( 500 );
+            while (numReceived < count) {
+                mutex.wait(500);
 
-                if( --stopAtZero == 0 ) {
+                if (--stopAtZero == 0) {
                     break;
                 }
             }
         }
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void CMSListener::onMessage( const cms::Message* message ) {
+void CMSListener::onMessage(const cms::Message* message) {
 
-    if( session->getAcknowledgeMode() == cms::Session::CLIENT_ACKNOWLEDGE ) {
+    if (session->getAcknowledgeMode() == cms::Session::CLIENT_ACKNOWLEDGE) {
         try {
             message->acknowledge();
-        } catch( CMSException& ex ) {
-            CPPUNIT_ASSERT_MESSAGE(ex.getStackTraceString(), false );
+        } catch (CMSException& ex) {
+            CPPUNIT_ASSERT_MESSAGE(ex.getStackTraceString(), false);
         }
     }
 
     // Got a text message.
-    const cms::TextMessage* txtMsg =
-        dynamic_cast<const cms::TextMessage*>( message );
+    const cms::TextMessage* txtMsg = dynamic_cast<const cms::TextMessage*>(message);
 
-    if( txtMsg != NULL ) {
+    if (txtMsg != NULL) {
         numReceived++;
 
         // Signal that we got one
@@ -90,10 +89,9 @@ void CMSListener::onMessage( const cms::Message* message ) {
     }
 
     // Got a bytes msg.
-    const cms::BytesMessage* bytesMsg =
-        dynamic_cast<const cms::BytesMessage*>( message );
+    const cms::BytesMessage* bytesMsg = dynamic_cast<const cms::BytesMessage*>(message);
 
-    if( bytesMsg != NULL ) {
+    if (bytesMsg != NULL) {
 
         numReceived++;
 
@@ -107,6 +105,6 @@ void CMSListener::onMessage( const cms::Message* message ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void CMSListener::onException( const cms::CMSException& error ) {
-    CPPUNIT_ASSERT_MESSAGE( error.getStackTraceString(), false );
+void CMSListener::onException(const cms::CMSException& error) {
+    CPPUNIT_ASSERT_MESSAGE(error.getStackTraceString(), false);
 }

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/ace7a74c/activemq-cpp/src/test-integration/activemq/util/CMSListener.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/util/CMSListener.h b/activemq-cpp/src/test-integration/activemq/util/CMSListener.h
index 2cb8764..7e62fbf 100644
--- a/activemq-cpp/src/test-integration/activemq/util/CMSListener.h
+++ b/activemq-cpp/src/test-integration/activemq/util/CMSListener.h
@@ -42,7 +42,7 @@ namespace util {
 
     public:
 
-        CMSListener( cms::Session* session );
+        CMSListener(cms::Session* session);
         virtual ~CMSListener();
 
         unsigned int getNumReceived() const {
@@ -51,10 +51,10 @@ namespace util {
 
         virtual void reset();
 
-        virtual void asyncWaitForMessages( unsigned int count );
+        virtual void asyncWaitForMessages(unsigned int count);
 
-        virtual void onException( const cms::CMSException& error );
-        virtual void onMessage( const cms::Message* message );
+        virtual void onException(const cms::CMSException& error);
+        virtual void onMessage(const cms::Message* message);
 
     };
 

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/ace7a74c/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp b/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
index 4e4c23b..d7a7657 100644
--- a/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
+++ b/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
@@ -155,8 +155,8 @@ void CMSProvider::initialize(const std::string& username, const std::string&
pas
         // Force a new session to be created.
         reconnectSession();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -175,8 +175,8 @@ void CMSProvider::reconnect() {
             reconnectSession();
         }
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -210,8 +210,8 @@ void CMSProvider::reconnectSession() {
         // destroyed.
         this->session.reset( this->connection->createSession( this->ackMode )
);
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -233,24 +233,23 @@ void CMSProvider::unsubscribe() {
             this->session->unsubscribe(this->subscription);
         }
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::ConnectionFactory* CMSProvider::getConnectionFactory() {
     try {
 
-        if( this->connectionFactory.get() == NULL ) {
+        if (this->connectionFactory.get() == NULL) {
             throw decaf::lang::exceptions::IllegalStateException(
-                __FILE__, __LINE__,
-                "CMSProvider has not been Initialized or is closed." );
+                __FILE__, __LINE__, "CMSProvider has not been Initialized or is closed.");
         }
 
         return this->connectionFactory.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -258,16 +257,15 @@ cms::Connection* CMSProvider::getConnection() {
 
     try {
 
-        if( this->connection.get() == NULL ) {
+        if (this->connection.get() == NULL) {
             throw decaf::lang::exceptions::IllegalStateException(
-                __FILE__, __LINE__,
-                "CMSProvider has not been Initialized or is closed." );
+                __FILE__, __LINE__, "CMSProvider has not been Initialized or is closed.");
         }
 
         return this->connection.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -275,16 +273,15 @@ cms::Session* CMSProvider::getSession() {
 
     try {
 
-        if( this->connection.get() == NULL ) {
+        if (this->connection.get() == NULL) {
             throw decaf::lang::exceptions::IllegalStateException(
-                __FILE__, __LINE__,
-                "CMSProvider has not been Initialized or is closed." );
+                __FILE__, __LINE__, "CMSProvider has not been Initialized or is closed.");
         }
 
         return this->session.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -292,21 +289,19 @@ cms::MessageProducer* CMSProvider::getProducer() {
 
     try {
 
-        if( this->connection.get() == NULL ) {
+        if (this->connection.get() == NULL) {
             throw decaf::lang::exceptions::IllegalStateException(
-                __FILE__, __LINE__,
-                "CMSProvider has not been Initialized or is closed." );
+                __FILE__, __LINE__, "CMSProvider has not been Initialized or is closed.");
         }
 
-        if( this->producer.get() == NULL ) {
-            this->producer.reset(
-                this->getSession()->createProducer( this->getDestination() ) );
+        if (this->producer.get() == NULL) {
+            this->producer.reset(this->getSession()->createProducer(this->getDestination()));
         }
 
         return this->producer.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -325,8 +320,8 @@ cms::MessageProducer* CMSProvider::getNoDestProducer() {
 
         return this->noDestProducer.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -341,8 +336,9 @@ cms::MessageConsumer* CMSProvider::getConsumer() {
 
         if (this->consumer.get() == NULL) {
             if (this->durable && this->topic) {
-                this->consumer.reset(this->getSession()->createDurableConsumer(
-                    dynamic_cast<cms::Topic*> (this->getDestination()), this->subscription,
""));
+                this->consumer.reset(
+                        this->getSession()->createDurableConsumer(dynamic_cast<cms::Topic*>(this->getDestination()),
+                                this->subscription, ""));
             } else {
                 this->consumer.reset(this->getSession()->createConsumer(this->getDestination()));
             }
@@ -350,8 +346,8 @@ cms::MessageConsumer* CMSProvider::getConsumer() {
 
         return this->consumer.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -374,8 +370,8 @@ cms::Destination* CMSProvider::getDestination() {
 
         return this->destination.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -398,8 +394,8 @@ cms::Destination* CMSProvider::getTempDestination() {
 
         return this->tempDestination.get();
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -412,7 +408,7 @@ void CMSProvider::destroyDestination(const cms::Destination* destination)
{
                 __FILE__, __LINE__, "CMSProvider has not been Initialized or is closed.");
         }
 
-        ActiveMQConnection* amqConnection = dynamic_cast<ActiveMQConnection*> (this->connection.get());
+        ActiveMQConnection* amqConnection = dynamic_cast<ActiveMQConnection*>(this->connection.get());
 
         try {
             amqConnection->destroyDestination(destination);
@@ -423,6 +419,6 @@ void CMSProvider::destroyDestination(const cms::Destination* destination)
{
         } catch (...) {
         }
     }
-    AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
-    AMQ_CATCHALL_THROW( activemq::exceptions::ActiveMQException )
+    AMQ_CATCH_RETHROW(activemq::exceptions::ActiveMQException)
+    AMQ_CATCHALL_THROW(activemq::exceptions::ActiveMQException)
 }


Mime
View raw message