You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2008/02/24 23:29:24 UTC
svn commit: r630689 - in
/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil: CmsAccessor.cpp
CmsTemplate.cpp
Author: nmittler
Date: Sun Feb 24 14:29:23 2008
New Revision: 630689
URL: http://svn.apache.org/viewvc?rev=630689&view=rev
Log: (empty)
Modified:
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp?rev=630689&r1=630688&r2=630689&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp Sun Feb 24 14:29:23 2008
@@ -16,8 +16,11 @@
*/
#include "CmsAccessor.h"
+#include <activemq/exceptions/ExceptionDefines.h>
+#include <activemq/exceptions/ActiveMQException.h>
using namespace activemq::cmsutil;
+using namespace activemq::exceptions;
using namespace decaf::lang::exceptions;
////////////////////////////////////////////////////////////////////////////////
@@ -33,28 +36,43 @@
cms::Connection* CmsAccessor::createConnection()
throw (cms::CMSException,IllegalStateException) {
- checkConnectionFactory();
-
- // Create the connection.
- cms::Connection* c = getConnectionFactory()->createConnection();
-
- // Manage the lifecycle of this resource.
- getResourceLifecycleManager()->addConnection(c);
-
- return c;
+ try {
+
+ checkConnectionFactory();
+
+ // Create the connection.
+ cms::Connection* c = getConnectionFactory()->createConnection();
+
+ // Manage the lifecycle of this resource.
+ getResourceLifecycleManager()->addConnection(c);
+
+ return c;
+ }
+ AMQ_CATCH_RETHROW( IllegalStateException )
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
}
////////////////////////////////////////////////////////////////////////////////
cms::Session* CmsAccessor::createSession(cms::Connection* con)
throw (cms::CMSException,IllegalStateException) {
- // Create the session.
- cms::Session* s = con->createSession(getSessionAcknowledgeMode());
-
- // Manage the lifecycle of this resource.
- getResourceLifecycleManager()->addSession(s);
-
- return s;
+ try {
+ if( con == NULL ) {
+ throw ActiveMQException(__FILE__, __LINE__, "connection object is invalid");
+ }
+
+ // Create the session.
+ cms::Session* s = con->createSession(getSessionAcknowledgeMode());
+
+ // Manage the lifecycle of this resource.
+ getResourceLifecycleManager()->addSession(s);
+
+ return s;
+ }
+ AMQ_CATCH_RETHROW( IllegalStateException )
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp?rev=630689&r1=630688&r2=630689&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp Sun Feb 24 14:29:23 2008
@@ -73,7 +73,7 @@
////////////////////////////////////////////////////////////////////////////////
CmsTemplate::~CmsTemplate() {
-
+
try {
destroy();
} catch( ... ) { /* Absorb */ }
@@ -141,6 +141,8 @@
// Invoke the base class.
CmsDestinationAccessor::init();
+
+ initialized = true;
}
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
@@ -231,6 +233,7 @@
return connection;
}
+ CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCHALL(this)
}
@@ -417,6 +420,7 @@
// Return the session to the pool.
returnSession(pooledSession);
}
+ CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCHALL(this)
}
@@ -435,6 +439,7 @@
// Execute the action in a session.
execute(&cb);
}
+ CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCHALL(this)
}
@@ -454,6 +459,7 @@
// Execute the action in a session.
execute(&cb);
}
+ CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCHALL(this)
}
@@ -473,6 +479,7 @@
// Execute the action in a session.
execute(&cb);
}
+ CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCHALL(this)
}
@@ -624,6 +631,7 @@
throw (cms::CMSException) {
cms::MessageConsumer* consumer = NULL;
+ message = NULL;
try {