Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 59005 invoked from network); 24 Feb 2008 22:29:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Feb 2008 22:29:48 -0000 Received: (qmail 20045 invoked by uid 500); 24 Feb 2008 22:29:44 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 20025 invoked by uid 500); 24 Feb 2008 22:29:44 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 20016 invoked by uid 99); 24 Feb 2008 22:29:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Feb 2008 14:29:43 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Feb 2008 22:29:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B72221A9832; Sun, 24 Feb 2008 14:29:24 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r630689 - in /activemq/activemq-cpp/trunk/src/main/activemq/cmsutil: CmsAccessor.cpp CmsTemplate.cpp Date: Sun, 24 Feb 2008 22:29:24 -0000 To: commits@activemq.apache.org From: nmittler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080224222924.B72221A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 +#include 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 {