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 2012/10/18 17:35:24 UTC
svn commit: r1399699 [1/2] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src/main: ./ activemq/core/
activemq/core/policies/ activemq/exceptions/ activemq/io/
Author: tabish
Date: Thu Oct 18 15:35:22 2012
New Revision: 1399699
URL: http://svn.apache.org/viewvc?rev=1399699&view=rev
Log:
Code cleanup and fix some throw clauses so they preserve exception types, remove unneeded includes from some headers and remove some old throw clauses.
Added:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.cpp (with props)
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.cpp (with props)
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.cpp (with props)
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.cpp (with props)
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.cpp (with props)
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.cpp (with props)
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.cpp (with props)
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionMetaData.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXASession.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Thu Oct 18 15:35:22 2012
@@ -90,6 +90,7 @@ cc_sources = \
activemq/commands/TransactionInfo.cpp \
activemq/commands/WireFormatInfo.cpp \
activemq/commands/XATransactionId.cpp \
+ activemq/core/ActiveMQAckHandler.cpp \
activemq/core/ActiveMQConnection.cpp \
activemq/core/ActiveMQConnectionFactory.cpp \
activemq/core/ActiveMQConnectionMetaData.cpp \
@@ -104,10 +105,14 @@ cc_sources = \
activemq/core/ActiveMQXAConnectionFactory.cpp \
activemq/core/ActiveMQXASession.cpp \
activemq/core/AdvisoryConsumer.cpp \
+ activemq/core/DispatchData.cpp \
+ activemq/core/Dispatcher.cpp \
activemq/core/FifoMessageDispatchChannel.cpp \
+ activemq/core/MessageDispatchChannel.cpp \
activemq/core/PrefetchPolicy.cpp \
activemq/core/RedeliveryPolicy.cpp \
activemq/core/SimplePriorityMessageDispatchChannel.cpp \
+ activemq/core/Synchronization.cpp \
activemq/core/kernels/ActiveMQConsumerKernel.cpp \
activemq/core/kernels/ActiveMQProducerKernel.cpp \
activemq/core/kernels/ActiveMQSessionKernel.cpp \
@@ -115,6 +120,8 @@ cc_sources = \
activemq/core/policies/DefaultPrefetchPolicy.cpp \
activemq/core/policies/DefaultRedeliveryPolicy.cpp \
activemq/exceptions/ActiveMQException.cpp \
+ activemq/exceptions/BrokerException.cpp \
+ activemq/exceptions/ConnectionFailedException.cpp \
activemq/io/LoggingInputStream.cpp \
activemq/io/LoggingOutputStream.cpp \
activemq/library/ActiveMQCPP.cpp \
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ActiveMQAckHandler.h"
+
+using namespace activemq;
+using namespace activemq::core;
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQAckHandler::~ActiveMQAckHandler() {}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQAckHandler.h Thu Oct 18 15:35:22 2012
@@ -17,7 +17,6 @@
#ifndef _ACTIVEMQ_CORE_ACTIVEMQACKHANDLER_H_
#define _ACTIVEMQ_CORE_ACTIVEMQACKHANDLER_H_
-#include <cms/CMSException.h>
#include <activemq/util/Config.h>
namespace activemq{
@@ -35,7 +34,7 @@ namespace core{
class AMQCPP_API ActiveMQAckHandler {
public:
- virtual ~ActiveMQAckHandler() {};
+ virtual ~ActiveMQAckHandler();
/**
* Method called to acknowledge the message once it has been received by a
@@ -46,7 +45,7 @@ namespace core{
*
* @throw CMSException if an error occurs while acknowledging the given Message.
*/
- virtual void acknowledgeMessage( const commands::Message* message ) = 0;
+ virtual void acknowledgeMessage(const commands::Message* message) = 0;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Thu Oct 18 15:35:22 2012
@@ -21,6 +21,7 @@
#include <activemq/core/ActiveMQSession.h>
#include <activemq/core/ActiveMQConstants.h>
+#include <activemq/core/ActiveMQConnectionMetaData.h>
#include <activemq/core/AdvisoryConsumer.h>
#include <activemq/core/kernels/ActiveMQSessionKernel.h>
#include <activemq/core/kernels/ActiveMQProducerKernel.h>
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h Thu Oct 18 15:35:22 2012
@@ -20,7 +20,6 @@
#include <cms/Connection.h>
#include <activemq/util/Config.h>
-#include <activemq/core/ActiveMQConnectionMetaData.h>
#include <activemq/core/Dispatcher.h>
#include <activemq/commands/ActiveMQTempDestination.h>
#include <activemq/commands/ConnectionInfo.h>
@@ -684,7 +683,7 @@ namespace core{
* Notify the exception listener
* @param ex the exception to fire
*/
- virtual void fire( const exceptions::ActiveMQException& ex );
+ virtual void fire(const exceptions::ActiveMQException& ex);
/**
* Indicates that a Connection resource that is processing the transportInterrupted
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp Thu Oct 18 15:35:22 2012
@@ -57,8 +57,8 @@ namespace core{
class FactorySettings {
private:
- FactorySettings( const FactorySettings& );
- FactorySettings& operator= ( const FactorySettings& );
+ FactorySettings(const FactorySettings&);
+ FactorySettings& operator=(const FactorySettings&);
public:
@@ -107,91 +107,83 @@ namespace core{
defaultRedeliveryPolicy(new DefaultRedeliveryPolicy()) {
}
- void updateConfiguration( const URI& uri ) {
+ void updateConfiguration(const URI& uri) {
this->brokerURI = uri;
this->properties->clear();
- if( uri.getQuery() != "" ) {
+ if (uri.getQuery() != "") {
- // Not a composite URI so this works fine.
- try{
- URISupport::parseQuery( uri.getQuery(), properties.get() );
- } catch(URISyntaxException& ex) {}
+ // Not a composite URI so this works fine.
+ try {
+ URISupport::parseQuery(uri.getQuery(), properties.get());
+ } catch (URISyntaxException& ex) {
+ }
} else {
- // Composite URI won't indicate it has a query even if it does.
- try{
- CompositeData composite = URISupport::parseComposite( uri );
- *this->properties = composite.getParameters();
- } catch(URISyntaxException& ex) {}
+ // Composite URI won't indicate it has a query even if it does.
+ try {
+ CompositeData composite = URISupport::parseComposite(uri);
+ *this->properties = composite.getParameters();
+ } catch (URISyntaxException& ex) {
+ }
}
// Check the connection options
this->alwaysSyncSend = Boolean::parseBoolean(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_ALWAYSSYNCSEND ), "false" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_ALWAYSSYNCSEND), "false"));
this->useAsyncSend = Boolean::parseBoolean(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_USEASYNCSEND ), "false" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_USEASYNCSEND), "false"));
this->useCompression = Boolean::parseBoolean(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_USECOMPRESSION ), "false" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_USECOMPRESSION), "false"));
this->compressionLevel = Integer::parseInt(
- properties->getProperty( "connection.compressionLevel", "-1" ) );
+ properties->getProperty("connection.compressionLevel", "-1"));
this->messagePrioritySupported = Boolean::parseBoolean(
- properties->getProperty( "connection.messagePrioritySupported", "true" ) );
+ properties->getProperty("connection.messagePrioritySupported", "true"));
this->dispatchAsync = Boolean::parseBoolean(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_DISPATCHASYNC ), "true" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_DISPATCHASYNC), "true"));
this->producerWindowSize = Integer::parseInt(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_PRODUCERWINDOWSIZE ), "0" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_PRODUCERWINDOWSIZE), "0"));
this->sendTimeout = decaf::lang::Integer::parseInt(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_SENDTIMEOUT ), "0" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_SENDTIMEOUT), "0"));
this->closeTimeout = decaf::lang::Integer::parseInt(
- properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::CONNECTION_CLOSETIMEOUT ), "15000" ) );
+ properties->getProperty(core::ActiveMQConstants::toString(
+ core::ActiveMQConstants::CONNECTION_CLOSETIMEOUT), "15000"));
this->clientId = properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::PARAM_CLIENTID ), clientId );
+ core::ActiveMQConstants::toString(core::ActiveMQConstants::PARAM_CLIENTID), clientId);
this->username = properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::PARAM_USERNAME ), username );
+ core::ActiveMQConstants::toString(core::ActiveMQConstants::PARAM_USERNAME), username);
this->password = properties->getProperty(
- core::ActiveMQConstants::toString(
- core::ActiveMQConstants::PARAM_PASSWORD ), password );
+ core::ActiveMQConstants::toString(core::ActiveMQConstants::PARAM_PASSWORD), password);
- this->defaultPrefetchPolicy->configure( *properties );
- this->defaultRedeliveryPolicy->configure( *properties );
+ this->defaultPrefetchPolicy->configure(*properties);
+ this->defaultRedeliveryPolicy->configure(*properties);
}
static URI createURI(const std::string& uriString) {
- try{
- return URI(uriString);
- } catch(URISyntaxException& ex) {
- throw cms::CMSException("Invalid Connection Uri detected.");
- }
+ try {
+ return URI(uriString);
+ } catch (URISyntaxException& ex) {
+ throw cms::CMSException("Invalid Connection Uri detected.");
+ }
}
};
@@ -199,7 +191,6 @@ namespace core{
////////////////////////////////////////////////////////////////////////////////
cms::ConnectionFactory* cms::ConnectionFactory::createCMSConnectionFactory(const std::string& brokerURI) {
-
return new ActiveMQConnectionFactory( brokerURI );
}
@@ -219,8 +210,8 @@ ActiveMQConnectionFactory::ActiveMQConne
this->settings->username = username;
}
if (!password.empty()) {
- this->settings->password = password;
- }
+ this->settings->password = password;
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -230,37 +221,37 @@ ActiveMQConnectionFactory::ActiveMQConne
this->setBrokerURI(uri);
- // Store login data in the properties
- if (!username.empty()) {
- this->settings->username = username;
- }
- if (!password.empty()) {
- this->settings->password = password;
- }
+ // Store login data in the properties
+ if (!username.empty()) {
+ this->settings->username = username;
+ }
+ if (!password.empty()) {
+ this->settings->password = password;
+ }
}
////////////////////////////////////////////////////////////////////////////////
ActiveMQConnectionFactory::~ActiveMQConnectionFactory() {
- try{
+ try {
delete this->settings;
}
- DECAF_CATCH_NOTHROW( Exception )
+ DECAF_CATCH_NOTHROW(Exception)
DECAF_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
cms::Connection* ActiveMQConnectionFactory::createConnection() {
- return doCreateConnection( settings->brokerURI, settings->username, settings->password, settings->clientId );
+ return doCreateConnection(settings->brokerURI, settings->username, settings->password, settings->clientId);
}
////////////////////////////////////////////////////////////////////////////////
cms::Connection* ActiveMQConnectionFactory::createConnection(const std::string& username, const std::string& password) {
- return doCreateConnection( settings->brokerURI, username, password, settings->clientId );
+ return doCreateConnection(settings->brokerURI, username, password, settings->clientId);
}
////////////////////////////////////////////////////////////////////////////////
cms::Connection* ActiveMQConnectionFactory::createConnection(const std::string& username, const std::string& password, const std::string& clientId) {
- return doCreateConnection( settings->brokerURI, username, password, clientId );
+ return doCreateConnection(settings->brokerURI, username, password, clientId);
}
////////////////////////////////////////////////////////////////////////////////
@@ -272,63 +263,59 @@ cms::Connection* ActiveMQConnectionFacto
Pointer<Transport> transport;
auto_ptr<ActiveMQConnection> connection;
- try{
+ try {
- this->setBrokerURI( uri );
+ this->setBrokerURI(uri);
// Store login data in the properties
- if( !username.empty() ) {
+ if (!username.empty()) {
this->settings->username = username;
}
- if( !password.empty() ) {
+ if (!password.empty()) {
this->settings->password = password;
}
- if( !clientId.empty() ) {
+ if (!clientId.empty()) {
this->settings->clientId = clientId;
}
// Use the TransportBuilder to get our Transport
- transport =
- TransportRegistry::getInstance().findFactory( uri.getScheme() )->create( uri );
+ transport = TransportRegistry::getInstance().findFactory(uri.getScheme())->create(uri);
- if( transport == NULL ){
- throw ActiveMQException(
- __FILE__, __LINE__,
- "ActiveMQConnectionFactory::createConnection - "
- "failed creating new Transport" );
+ if (transport == NULL) {
+ throw ActiveMQException(__FILE__, __LINE__, "ActiveMQConnectionFactory::createConnection - "
+ "failed creating new Transport");
}
- Pointer<Properties> properties( this->settings->properties->clone() );
+ Pointer<Properties> properties(this->settings->properties->clone());
// Create and Return the new connection object.
- connection.reset( createActiveMQConnection( transport, properties ) );
+ connection.reset(createActiveMQConnection(transport, properties));
// Set all options parsed from the URI.
- configureConnection( connection.get() );
+ configureConnection(connection.get());
// Now start the connection since all other configuration is done.
transport->start();
- if( !this->settings->clientId.empty() ) {
- connection->setDefaultClientId( this->settings->clientId );
+ if (!this->settings->clientId.empty()) {
+ connection->setDefaultClientId(this->settings->clientId);
}
return connection.release();
- }
- catch( cms::CMSException& ex ){
- ex.setMark( __FILE__, __LINE__ );
+ } catch (cms::CMSException& ex) {
+ ex.setMark(__FILE__, __LINE__);
throw ex;
- } catch( activemq::exceptions::ActiveMQException& ex ){
- ex.setMark( __FILE__, __LINE__ );
+ } catch (activemq::exceptions::ActiveMQException& ex) {
+ ex.setMark(__FILE__, __LINE__);
throw ex.convertToCMSException();
- } catch( decaf::lang::Exception& ex ){
- ex.setMark( __FILE__, __LINE__ );
- activemq::exceptions::ActiveMQException amqEx( ex );
+ } catch (decaf::lang::Exception& ex) {
+ ex.setMark(__FILE__, __LINE__);
+ activemq::exceptions::ActiveMQException amqEx(ex);
throw amqEx.convertToCMSException();
- } catch( std::exception& ex ) {
- throw cms::CMSException( ex.what(), NULL );
- } catch(...) {
- throw cms::CMSException( "Caught Unknown Exception", NULL );
+ } catch (std::exception& ex) {
+ throw cms::CMSException(ex.what(), NULL);
+ } catch (...) {
+ throw cms::CMSException("Caught Unknown Exception", NULL);
}
}
@@ -337,19 +324,16 @@ ActiveMQConnection* ActiveMQConnectionFa
const Pointer<transport::Transport>& transport,
const Pointer<decaf::util::Properties>& properties) {
- return new ActiveMQConnection( transport, properties );
+ return new ActiveMQConnection(transport, properties);
}
////////////////////////////////////////////////////////////////////////////////
-cms::Connection* ActiveMQConnectionFactory::createConnection(
- const std::string& uri,
- const std::string& username,
- const std::string& password,
- const std::string& clientId) {
-
+cms::Connection* ActiveMQConnectionFactory::createConnection(const std::string& uri,
+ const std::string& username,
+ const std::string& password,
+ const std::string& clientId) {
ActiveMQConnectionFactory factory;
-
- return factory.doCreateConnection( URI( uri ), username, password, clientId );
+ return factory.doCreateConnection(URI(uri), username, password, clientId);
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.h Thu Oct 18 15:35:22 2012
@@ -63,7 +63,9 @@ namespace core{
* @param username to authenticate with, defaults to ""
* @param password to authenticate with, defaults to ""
*/
- ActiveMQConnectionFactory(const std::string& uri, const std::string& username = "", const std::string& password = "");
+ ActiveMQConnectionFactory(const std::string& uri,
+ const std::string& username = "",
+ const std::string& password = "");
/**
* Constructor
@@ -71,7 +73,9 @@ namespace core{
* @param username to authenticate with, defaults to ""
* @param password to authenticate with, defaults to ""
*/
- ActiveMQConnectionFactory(const decaf::net::URI& uri, const std::string& username = "", const std::string& password = "");
+ ActiveMQConnectionFactory(const decaf::net::URI& uri,
+ const std::string& username = "",
+ const std::string& password = "");
virtual ~ActiveMQConnectionFactory();
@@ -98,7 +102,8 @@ namespace core{
* @returns a Connection Pointer
* @throws CMSException
*/
- virtual cms::Connection* createConnection(const std::string& username, const std::string& password);
+ virtual cms::Connection* createConnection(const std::string& username,
+ const std::string& password);
/**
* Creates a connection with the specified user identity. The
@@ -115,7 +120,9 @@ namespace core{
* @returns a Connection Pointer
* @throws CMSException
*/
- virtual cms::Connection* createConnection(const std::string& username, const std::string& password, const std::string& clientId);
+ virtual cms::Connection* createConnection(const std::string& username,
+ const std::string& password,
+ const std::string& clientId);
public: // Configuration Options
@@ -332,7 +339,7 @@ namespace core{
* cause all messages to be sent using a Synchronous request is non-zero.
* @param timeout - The time to wait for a response.
*/
- void setSendTimeout( unsigned int timeout );
+ void setSendTimeout(unsigned int timeout);
/**
* Gets the assigned close timeout for this Connector
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionMetaData.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionMetaData.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionMetaData.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionMetaData.h Thu Oct 18 15:35:22 2012
@@ -34,8 +34,8 @@ namespace core {
class AMQCPP_API ActiveMQConnectionMetaData : public cms::ConnectionMetaData {
private:
- ActiveMQConnectionMetaData( const ActiveMQConnectionMetaData& );
- ActiveMQConnectionMetaData& operator= ( const ActiveMQConnectionMetaData& );
+ ActiveMQConnectionMetaData(const ActiveMQConnectionMetaData&);
+ ActiveMQConnectionMetaData& operator=(const ActiveMQConnectionMetaData&);
public:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.cpp Thu Oct 18 15:35:22 2012
@@ -56,11 +56,10 @@ ActiveMQConstants::StaticInitializer::St
uriParams[PARAM_PASSWORD] = "password";
uriParams[PARAM_CLIENTID] = "client-id";
- for( int ix=0; ix<NUM_OPTIONS; ++ix ){
- destOptionMap[destOptions[ix]] = (DestinationOption)ix;
+ for (int ix = 0; ix < NUM_OPTIONS; ++ix) {
+ destOptionMap[destOptions[ix]] = (DestinationOption) ix;
}
- for( int ix=0; ix<NUM_PARAMS; ++ix ){
- uriParamsMap[uriParams[ix]] = (URIParam)ix;
+ for (int ix = 0; ix < NUM_PARAMS; ++ix) {
+ uriParamsMap[uriParams[ix]] = (URIParam) ix;
}
-
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConstants.h Thu Oct 18 15:35:22 2012
@@ -96,40 +96,38 @@ namespace core{
NUM_PARAMS
};
- static const std::string& toString( const DestinationOption option ){
+ static const std::string& toString(const DestinationOption option) {
return StaticInitializer::destOptions[option];
}
- static DestinationOption toDestinationOption( const std::string& option ){
- std::map< std::string, DestinationOption >::iterator iter =
- StaticInitializer::destOptionMap.find( option );
+ static DestinationOption toDestinationOption(const std::string& option) {
+ std::map<std::string, DestinationOption>::iterator iter = StaticInitializer::destOptionMap.find(option);
- if( iter == StaticInitializer::destOptionMap.end() ){
+ if (iter == StaticInitializer::destOptionMap.end()) {
return NUM_OPTIONS;
}
return iter->second;
}
- static const std::string& toString( const URIParam option ){
+ static const std::string& toString(const URIParam option) {
return StaticInitializer::uriParams[option];
}
- static URIParam toURIOption( const std::string& option ){
- std::map< std::string, URIParam >::iterator iter =
- StaticInitializer::uriParamsMap.find( option );
+ static URIParam toURIOption(const std::string& option) {
+ std::map<std::string, URIParam>::iterator iter = StaticInitializer::uriParamsMap.find(option);
- if( iter == StaticInitializer::uriParamsMap.end() ){
+ if (iter == StaticInitializer::uriParamsMap.end()) {
return NUM_PARAMS;
}
return iter->second;
}
- class StaticInitializer{
+ class StaticInitializer {
public:
StaticInitializer();
- virtual ~StaticInitializer(){}
+ virtual ~StaticInitializer() {}
static std::string destOptions[NUM_OPTIONS];
static std::string uriParams[NUM_PARAMS];
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp Thu Oct 18 15:35:22 2012
@@ -49,8 +49,7 @@ namespace core {
Pointer<ActiveMQConsumerKernel> kernel;
- ActiveMQConsumerData(const Pointer<ActiveMQConsumerKernel>& kernel) : kernel(kernel) {
- }
+ ActiveMQConsumerData(const Pointer<ActiveMQConsumerKernel>& kernel) : kernel(kernel) {}
};
}}
@@ -78,7 +77,6 @@ ActiveMQConsumer::~ActiveMQConsumer() {
delete this->config;
}
- AMQ_CATCH_NOTHROW(ActiveMQException)
AMQ_CATCHALL_NOTHROW()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h Thu Oct 18 15:35:22 2012
@@ -24,7 +24,6 @@
#include <activemq/util/Config.h>
#include <activemq/core/kernels/ActiveMQConsumerKernel.h>
-#include <activemq/exceptions/ActiveMQException.h>
#include <activemq/commands/ConsumerInfo.h>
#include <activemq/core/RedeliveryPolicy.h>
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Thu Oct 18 15:35:22 2012
@@ -43,14 +43,13 @@ ActiveMQProducer::~ActiveMQProducer() {
try {
this->kernel->close();
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
+ AMQ_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
void ActiveMQProducer::close() {
- try{
+ try {
this->kernel->close();
}
AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp Thu Oct 18 15:35:22 2012
@@ -66,7 +66,7 @@ namespace core{
cms::MessageListener* listener ) :
ActiveMQConsumerKernel(session, id, destination, name, selector, prefetch,
maxPendingMessageCount, noLocal, browser, dispatchAsync,
- listener ), parent(parent) {
+ listener), parent(parent) {
}
@@ -127,7 +127,7 @@ ActiveMQQueueBrowser::ActiveMQQueueBrows
////////////////////////////////////////////////////////////////////////////////
ActiveMQQueueBrowser::~ActiveMQQueueBrowser() {
- try{
+ try {
this->close();
}
DECAF_CATCHALL_NOTHROW()
@@ -146,9 +146,9 @@ std::string ActiveMQQueueBrowser::getMes
////////////////////////////////////////////////////////////////////////////////
cms::MessageEnumeration* ActiveMQQueueBrowser::getEnumeration() {
- try{
+ try {
checkClosed();
- if( this->browser == NULL ) {
+ if (this->browser == NULL) {
this->browser = createConsumer();
}
return this;
@@ -158,7 +158,7 @@ cms::MessageEnumeration* ActiveMQQueueBr
////////////////////////////////////////////////////////////////////////////////
void ActiveMQQueueBrowser::close() {
- try{
+ try {
if (this->closed) {
return;
@@ -175,7 +175,7 @@ void ActiveMQQueueBrowser::close() {
////////////////////////////////////////////////////////////////////////////////
bool ActiveMQQueueBrowser::hasMoreMessages() {
- try{
+ try {
while (true) {
@@ -203,7 +203,7 @@ bool ActiveMQQueueBrowser::hasMoreMessag
////////////////////////////////////////////////////////////////////////////////
cms::Message* ActiveMQQueueBrowser::nextMessage() {
- try{
+ try {
while (true) {
@@ -220,7 +220,7 @@ cms::Message* ActiveMQQueueBrowser::next
return answer;
}
- } catch(cms::CMSException& e) {
+ } catch (cms::CMSException& e) {
return NULL;
}
@@ -257,16 +257,14 @@ Pointer<ActiveMQConsumerKernel> ActiveMQ
int prefetch = this->session->getConnection()->getPrefetchPolicy()->getQueueBrowserPrefetch();
- Pointer<ActiveMQConsumerKernel> consumer(
- new Browser(this, session, consumerId, destination, "", selector,
- prefetch, 0, false, true, dispatchAsync, NULL ) );
+ Pointer<ActiveMQConsumerKernel> consumer(new Browser(this, session, consumerId, destination, "", selector, prefetch, 0, false, true, dispatchAsync, NULL));
try {
this->session->addConsumer(consumer);
this->session->syncRequest(consumer->getConsumerInfo());
} catch (Exception& ex) {
this->session->removeConsumer(consumer);
- throw ex;
+ throw;
}
if (this->session->getConnection()->isStarted()) {
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Thu Oct 18 15:35:22 2012
@@ -53,8 +53,7 @@ ActiveMQSession::~ActiveMQSession() {
try {
this->kernel->close();
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
+ AMQ_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h Thu Oct 18 15:35:22 2012
@@ -21,7 +21,6 @@
#include <cms/ExceptionListener.h>
#include <activemq/util/Config.h>
-#include <activemq/exceptions/ActiveMQException.h>
#include <activemq/core/kernels/ActiveMQConsumerKernel.h>
#include <activemq/core/kernels/ActiveMQProducerKernel.h>
#include <activemq/core/kernels/ActiveMQSessionKernel.h>
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp Thu Oct 18 15:35:22 2012
@@ -125,7 +125,7 @@ ActiveMQTransactionContext::ActiveMQTran
////////////////////////////////////////////////////////////////////////////////
ActiveMQTransactionContext::~ActiveMQTransactionContext() {
- try{
+ try {
delete this->context;
}
AMQ_CATCHALL_NOTHROW()
@@ -176,10 +176,10 @@ void ActiveMQTransactionContext::begin()
this->context->transactionId = id.dynamicCast<TransactionId>();
}
}
- 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)
}
////////////////////////////////////////////////////////////////////////////////
@@ -216,10 +216,10 @@ void ActiveMQTransactionContext::commit(
}
}
}
- 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)
}
////////////////////////////////////////////////////////////////////////////////
@@ -251,10 +251,10 @@ void ActiveMQTransactionContext::rollbac
this->afterRollback();
}
}
- 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)
}
////////////////////////////////////////////////////////////////////////////////
@@ -337,25 +337,25 @@ bool ActiveMQTransactionContext::setTran
}
////////////////////////////////////////////////////////////////////////////////
-int ActiveMQTransactionContext::recover( int flag AMQCPP_UNUSED, Xid** recovered ) {
+int ActiveMQTransactionContext::recover(int flag AMQCPP_UNUSED, Xid** recovered) {
- Pointer<TransactionInfo> info( new TransactionInfo() );
- info->setConnectionId( this->connection->getConnectionInfo().getConnectionId() );
- info->setType( ActiveMQConstants::TRANSACTION_STATE_RECOVER );
+ Pointer<TransactionInfo> info(new TransactionInfo());
+ info->setConnectionId(this->connection->getConnectionInfo().getConnectionId());
+ info->setType(ActiveMQConstants::TRANSACTION_STATE_RECOVER);
try {
this->connection->checkClosedOrFailed();
this->connection->ensureConnectionInfoSent();
- Pointer<Response> response = this->connection->syncRequest( info );
+ Pointer<Response> response = this->connection->syncRequest(info);
Pointer<DataArrayResponse> arrayResponse = response.dynamicCast<DataArrayResponse>();
- std::vector< Pointer<DataStructure> > array = arrayResponse->getData();
+ std::vector<Pointer<DataStructure> > array = arrayResponse->getData();
- int size = (int)array.size();
+ int size = (int) array.size();
- if( size > 0 ) {
+ if (size > 0) {
// Allocate space for all the recovered Xid's, if client passed us an existing
// array then this would leak, but they were warned, so just go with it.
@@ -363,77 +363,76 @@ int ActiveMQTransactionContext::recover(
// We need to clone each Xid and then add it to the array, the client is now
// responsible for freeing this memory.
- for( int i = 0; i < size; ++i ) {
+ for (int i = 0; i < size; ++i) {
Pointer<XATransactionId> xid = array[i].dynamicCast<XATransactionId>();
recovered[i] = xid->clone();
}
}
return size;
- } catch( Exception& e ) {
- throw toXAException( e );
- } catch( CMSException& e ) {
- throw toXAException( e );
+ } catch (Exception& e) {
+ throw toXAException(e);
+ } catch (CMSException& e) {
+ throw toXAException(e);
}
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTransactionContext::start( const Xid* xid, int flags ) {
+void ActiveMQTransactionContext::start(const Xid* xid, int flags) {
- if( this->isInLocalTransaction() ) {
- throw XAException( XAException::XAER_PROTO );
+ if (this->isInLocalTransaction()) {
+ throw XAException(XAException::XAER_PROTO);
}
// Are we already associated?
- if( this->context->associatedXid != NULL ) {
- throw new XAException( XAException::XAER_PROTO );
+ if (this->context->associatedXid != NULL) {
+ throw new XAException(XAException::XAER_PROTO);
}
- const char* txSuspendResumeNotSupportMsg =
- "The suspend/resume of a transaction " \
- "is not supported. Instead it is recommended " \
- "that a new JMS session be created.";
+ const char* txSuspendResumeNotSupportMsg = "The suspend/resume of a transaction "
+ "is not supported. Instead it is recommended "
+ "that a new JMS session be created.";
- if( ( flags & TMJOIN ) == TMJOIN ) {
- throw XAException( txSuspendResumeNotSupportMsg );
+ if ((flags & TMJOIN) == TMJOIN) {
+ throw XAException(txSuspendResumeNotSupportMsg);
}
- if( ( flags & TMRESUME ) == TMRESUME ) {
- throw XAException( txSuspendResumeNotSupportMsg );
+ if ((flags & TMRESUME) == TMRESUME) {
+ throw XAException(txSuspendResumeNotSupportMsg);
}
// prepare for a new association
this->synchronizations.clear();
this->context->beforeEndIndex = 0;
- this->setXid( xid );
+ this->setXid(xid);
}
////////////////////////////////////////////////////////////////////////////////
-int ActiveMQTransactionContext::prepare( const Xid* xid ) {
+int ActiveMQTransactionContext::prepare(const Xid* xid) {
// We allow interleaving multiple transactions, so we don't limit prepare to the associated xid.
Pointer<XATransactionId> x;
// THIS SHOULD NEVER HAPPEN because end(xid, TMSUCCESS) should have been called first
- if( xid == NULL || equals( this->context->associatedXid.get(), xid ) ) {
- throw XAException( XAException::XAER_PROTO );
+ if (xid == NULL || equals(this->context->associatedXid.get(), xid)) {
+ throw XAException(XAException::XAER_PROTO);
} else {
- x.reset( new XATransactionId( xid ) );
+ x.reset(new XATransactionId(xid));
}
try {
- Pointer<TransactionInfo> info( new TransactionInfo() );
- info->setConnectionId( this->connection->getConnectionInfo().getConnectionId() );
- info->setTransactionId( x );
- info->setType( ActiveMQConstants::TRANSACTION_STATE_PREPARE );
+ Pointer<TransactionInfo> info(new TransactionInfo());
+ info->setConnectionId(this->connection->getConnectionInfo().getConnectionId());
+ info->setTransactionId(x);
+ info->setType(ActiveMQConstants::TRANSACTION_STATE_PREPARE);
// Find out if the server wants to commit or rollback.
- Pointer<Response> response = this->connection->syncRequest( info );
+ Pointer<Response> response = this->connection->syncRequest(info);
Pointer<IntegerResponse> intResponse = response.dynamicCast<IntegerResponse>();
- if( XAResource::XA_RDONLY == intResponse->getResult() ) {
+ if (XAResource::XA_RDONLY == intResponse->getResult()) {
// transaction stops now, may be syncs that need a callback
this->afterCommit();
@@ -441,39 +440,39 @@ int ActiveMQTransactionContext::prepare(
return intResponse->getResult();
- } catch( Exception& e ) {
+ } catch (Exception& e) {
- try{
+ try {
this->afterRollback();
- } catch(...) {
+ } catch (...) {
}
- throw toXAException( e );
+ throw toXAException(e);
- } catch( CMSException& e ) {
+ } catch (CMSException& e) {
- try{
+ try {
this->afterRollback();
- } catch(...) {
+ } catch (...) {
}
- throw toXAException( e );
+ throw toXAException(e);
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTransactionContext::commit( const Xid* xid, bool onePhase ) {
+void ActiveMQTransactionContext::commit(const Xid* xid, bool onePhase) {
// We allow interleaving multiple transactions, so we don't limit prepare to the associated xid.
Pointer<XATransactionId> x;
// THIS SHOULD NEVER HAPPEN because end(xid, TMSUCCESS) should have been called first
- if( xid == NULL || equals( this->context->associatedXid.get(), xid ) ) {
- throw XAException( XAException::XAER_PROTO );
+ if (xid == NULL || equals(this->context->associatedXid.get(), xid)) {
+ throw XAException(XAException::XAER_PROTO);
} else {
- x.reset( new XATransactionId( xid ) );
+ x.reset(new XATransactionId(xid));
}
try {
@@ -482,50 +481,49 @@ void ActiveMQTransactionContext::commit(
this->connection->ensureConnectionInfoSent();
// Let the server know that the tx is rollback.
- Pointer<TransactionInfo> info( new TransactionInfo() );
- info->setConnectionId( this->connection->getConnectionInfo().getConnectionId() );
- info->setTransactionId( x );
- info->setType( onePhase ? ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE :
- ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE );
+ Pointer<TransactionInfo> info(new TransactionInfo());
+ info->setConnectionId(this->connection->getConnectionInfo().getConnectionId());
+ info->setTransactionId(x);
+ info->setType(onePhase ? ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE : ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE);
- this->connection->syncRequest( info );
+ this->connection->syncRequest(info);
this->afterCommit();
- } catch( Exception& ex ) {
+ } catch (Exception& ex) {
try {
this->afterRollback();
- } catch(...) {
+ } catch (...) {
}
- throw toXAException( ex );
+ throw toXAException(ex);
- } catch( CMSException& e ) {
+ } catch (CMSException& e) {
try {
this->afterRollback();
- } catch(...) {
+ } catch (...) {
}
- throw toXAException( e );
+ throw toXAException(e);
}
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTransactionContext::rollback( const Xid* xid ) {
+void ActiveMQTransactionContext::rollback(const Xid* xid) {
// We allow interleaving multiple transactions, so we don't limit prepare to the associated xid.
Pointer<XATransactionId> x;
- if( xid == NULL ) {
- throw XAException( XAException::XAER_PROTO );
+ if (xid == NULL) {
+ throw XAException(XAException::XAER_PROTO);
}
- if( equals( this->context->associatedXid.get(), xid ) ) {
+ if (equals(this->context->associatedXid.get(), xid)) {
x = this->context->transactionId.dynamicCast<XATransactionId>();
} else {
- x.reset( new XATransactionId( xid ) );
+ x.reset(new XATransactionId(xid));
}
try {
@@ -534,124 +532,123 @@ void ActiveMQTransactionContext::rollbac
this->connection->ensureConnectionInfoSent();
// Let the server know that the tx is rollback.
- Pointer<TransactionInfo> info( new TransactionInfo() );
- info->setConnectionId( this->connection->getConnectionInfo().getConnectionId() );
- info->setTransactionId( x );
- info->setType( ActiveMQConstants::TRANSACTION_STATE_ROLLBACK );
+ Pointer<TransactionInfo> info(new TransactionInfo());
+ info->setConnectionId(this->connection->getConnectionInfo().getConnectionId());
+ info->setTransactionId(x);
+ info->setType(ActiveMQConstants::TRANSACTION_STATE_ROLLBACK);
- this->connection->syncRequest( info );
+ this->connection->syncRequest(info);
this->afterRollback();
- } catch( Exception& ex ) {
- throw toXAException( ex );
- } catch( CMSException& e ) {
- throw toXAException( e );
+ } catch (Exception& ex) {
+ throw toXAException(ex);
+ } catch (CMSException& e) {
+ throw toXAException(e);
}
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTransactionContext::end( const Xid* xid, int flags ) {
+void ActiveMQTransactionContext::end(const Xid* xid, int flags) {
- if( isInLocalTransaction() ) {
- throw XAException( XAException::XAER_PROTO );
+ if (isInLocalTransaction()) {
+ throw XAException(XAException::XAER_PROTO);
}
- if( ( flags & ( TMSUSPEND | TMFAIL ) ) != 0 ) {
+ if ((flags & (TMSUSPEND | TMFAIL)) != 0) {
// You can only suspend the associated xid.
- if( !equals( this->context->associatedXid.get(), xid ) ) {
- throw XAException( XAException::XAER_PROTO );
+ if (!equals(this->context->associatedXid.get(), xid)) {
+ throw XAException(XAException::XAER_PROTO);
}
try {
this->beforeEnd();
- } catch( Exception& e ) {
- throw toXAException( e );
- } catch( CMSException& e ) {
- throw toXAException( e );
+ } catch (Exception& e) {
+ throw toXAException(e);
+ } catch (CMSException& e) {
+ throw toXAException(e);
}
- setXid( NULL );
+ setXid(NULL);
- } else if( ( flags & TMSUCCESS ) == TMSUCCESS ) {
+ } else if ((flags & TMSUCCESS) == TMSUCCESS) {
// set to NULL if this is the current xid.
// otherwise this could be an asynchronous success call
- if( equals( this->context->associatedXid.get(), xid ) ) {
+ if (equals(this->context->associatedXid.get(), xid)) {
try {
beforeEnd();
- } catch( Exception& ex ) {
- throw toXAException( ex );
- } catch( CMSException& e ) {
- throw toXAException( e );
+ } catch (Exception& ex) {
+ throw toXAException(ex);
+ } catch (CMSException& e) {
+ throw toXAException(e);
}
- setXid( NULL );
+ setXid(NULL);
}
} else {
- throw XAException( XAException::XAER_INVAL );
+ throw XAException(XAException::XAER_INVAL);
}
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTransactionContext::forget( const Xid* xid ) {
+void ActiveMQTransactionContext::forget(const Xid* xid) {
// We allow interleaving multiple transactions, so we don't limit prepare to the associated xid.
Pointer<XATransactionId> x;
- if( xid == NULL ) {
- throw XAException( XAException::XAER_PROTO );
+ if (xid == NULL) {
+ throw XAException(XAException::XAER_PROTO);
}
- if( equals( this->context->associatedXid.get(), xid ) ) {
+ if (equals(this->context->associatedXid.get(), xid)) {
x = this->context->transactionId.dynamicCast<XATransactionId>();
} else {
- x.reset( new XATransactionId( xid ) );
+ x.reset(new XATransactionId(xid));
}
// Let the server know that the tx is rollback.
- Pointer<TransactionInfo> info( new TransactionInfo() );
- info->setConnectionId( this->connection->getConnectionInfo().getConnectionId() );
- info->setTransactionId( x );
- info->setType( ActiveMQConstants::TRANSACTION_STATE_FORGET );
+ Pointer<TransactionInfo> info(new TransactionInfo());
+ info->setConnectionId(this->connection->getConnectionInfo().getConnectionId());
+ info->setTransactionId(x);
+ info->setType(ActiveMQConstants::TRANSACTION_STATE_FORGET);
try {
- this->connection->syncRequest( info );
- } catch( Exception& ex ) {
- throw toXAException( ex );
- } catch( CMSException& e ) {
- throw toXAException( e );
+ this->connection->syncRequest(info);
+ } catch (Exception& ex) {
+ throw toXAException(ex);
+ } catch (CMSException& e) {
+ throw toXAException(e);
}
}
////////////////////////////////////////////////////////////////////////////////
-bool ActiveMQTransactionContext::isSameRM( const XAResource* resource ) {
+bool ActiveMQTransactionContext::isSameRM(const XAResource* resource) {
- if( resource == NULL ) {
+ if (resource == NULL) {
return false;
}
- const ActiveMQTransactionContext* cntx =
- dynamic_cast<const ActiveMQTransactionContext*>( resource );
+ const ActiveMQTransactionContext* cntx = dynamic_cast<const ActiveMQTransactionContext*>(resource);
- if( cntx == NULL ) {
+ if (cntx == NULL) {
return false;
}
- try{
+ try {
return getResourceManagerId() == cntx->getResourceManagerId();
- } catch( Exception& ex ) {
- throw toXAException( ex );
- } catch( CMSException& ex ) {
- throw XAException( "Could not get the Resource Manager Id.", &ex );
+ } catch (Exception& ex) {
+ throw toXAException(ex);
+ } catch (CMSException& ex) {
+ throw XAException("Could not get the Resource Manager Id.", &ex);
}
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTransactionContext::setXid( const Xid* xid ) {
+void ActiveMQTransactionContext::setXid(const Xid* xid) {
try {
this->connection->checkClosedOrFailed();
@@ -704,7 +701,7 @@ void ActiveMQTransactionContext::setXid(
}
////////////////////////////////////////////////////////////////////////////////
-bool ActiveMQTransactionContext::equals( const cms::Xid* local, const cms::Xid* remote ) {
+bool ActiveMQTransactionContext::equals(const cms::Xid* local, const cms::Xid* remote) {
if (local == remote) {
return true;
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.h Thu Oct 18 15:35:22 2012
@@ -32,6 +32,11 @@ namespace core {
class AMQCPP_API ActiveMQXAConnectionFactory : public cms::XAConnectionFactory,
public ActiveMQConnectionFactory {
+ private:
+
+ ActiveMQXAConnectionFactory(const ActiveMQXAConnectionFactory&);
+ ActiveMQXAConnectionFactory& operator= (const ActiveMQXAConnectionFactory&);
+
public:
ActiveMQXAConnectionFactory();
@@ -42,9 +47,9 @@ namespace core {
* @param username to authenticate with, defaults to ""
* @param password to authenticate with, defaults to ""
*/
- ActiveMQXAConnectionFactory( const std::string& uri,
- const std::string& username = "",
- const std::string& password = "" );
+ ActiveMQXAConnectionFactory(const std::string& uri,
+ const std::string& username = "",
+ const std::string& password = "");
/**
* Constructor
@@ -52,21 +57,21 @@ namespace core {
* @param username to authenticate with, defaults to ""
* @param password to authenticate with, defaults to ""
*/
- ActiveMQXAConnectionFactory( const decaf::net::URI& uri,
- const std::string& username = "",
- const std::string& password = "" );
+ ActiveMQXAConnectionFactory(const decaf::net::URI& uri,
+ const std::string& username = "",
+ const std::string& password = "");
virtual ~ActiveMQXAConnectionFactory();
virtual cms::XAConnection* createXAConnection();
- virtual cms::XAConnection* createXAConnection( const std::string& userName,
- const std::string& password );
+ virtual cms::XAConnection* createXAConnection(const std::string& userName,
+ const std::string& password);
protected:
- virtual ActiveMQConnection* createActiveMQConnection( const Pointer<transport::Transport>& transport,
- const Pointer<decaf::util::Properties>& properties );
+ virtual ActiveMQConnection* createActiveMQConnection(const Pointer<transport::Transport>& transport,
+ const Pointer<decaf::util::Properties>& properties);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXASession.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXASession.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXASession.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXASession.h Thu Oct 18 15:35:22 2012
@@ -34,6 +34,11 @@ namespace core {
Pointer<activemq::core::kernels::ActiveMQXASessionKernel> xaKernel;
+ private:
+
+ ActiveMQXASession(const ActiveMQXASession&);
+ ActiveMQXASession& operator= (const ActiveMQXASession&);
+
public:
ActiveMQXASession(Pointer<activemq::core::kernels::ActiveMQXASessionKernel> kernel);
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp Thu Oct 18 15:35:22 2012
@@ -79,7 +79,6 @@ AdvisoryConsumer::~AdvisoryConsumer() {
try {
delete config;
}
- AMQ_CATCH_NOTHROW(ActiveMQException)
AMQ_CATCHALL_NOTHROW()
}
@@ -90,7 +89,7 @@ void AdvisoryConsumer::dispose() {
try {
this->connection->oneway(this->config->info->createRemoveCommand());
- } catch (cms::CMSException e) {
+ } catch (cms::CMSException& e) {
}
this->connection->removeDispatcher(this->config->info->getConsumerId());
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "DispatchData.h"
+
+using namespace activemq;
+using namespace activemq::core;
+
+////////////////////////////////////////////////////////////////////////////////
+DispatchData::DispatchData() {}
+
+////////////////////////////////////////////////////////////////////////////////
+DispatchData::DispatchData(const decaf::lang::Pointer<commands::ConsumerId>& consumer,
+ const decaf::lang::Pointer<commands::Message>& message) {
+ this->consumerId = consumer;
+ this->message = message;
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/DispatchData.h Thu Oct 18 15:35:22 2012
@@ -18,8 +18,6 @@
#ifndef _ACTIVEMQ_CORE_DISPATCHDATA_H_
#define _ACTIVEMQ_CORE_DISPATCHDATA_H_
-#include <stdlib.h>
-#include <memory>
#include <activemq/util/Config.h>
#include <activemq/commands/ConsumerId.h>
#include <activemq/commands/Message.h>
@@ -40,15 +38,17 @@ namespace core {
decaf::lang::Pointer<commands::ConsumerId> consumerId;
decaf::lang::Pointer<commands::Message> message;
+ private:
+
+ DispatchData(const DispatchData&);
+ DispatchData& operator= (const DispatchData&);
+
public:
- DispatchData() {}
+ DispatchData();
DispatchData(const decaf::lang::Pointer<commands::ConsumerId>& consumer,
- const decaf::lang::Pointer<commands::Message>& message) {
- this->consumerId = consumer;
- this->message = message;
- }
+ const decaf::lang::Pointer<commands::Message>& message);
const decaf::lang::Pointer<commands::ConsumerId>& getConsumerId() {
return consumerId;
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Dispatcher.h"
+
+using namespace activemq;
+using namespace activemq::core;
+
+////////////////////////////////////////////////////////////////////////////////
+Dispatcher::~Dispatcher() {}
+
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h Thu Oct 18 15:35:22 2012
@@ -26,7 +26,6 @@ namespace activemq {
namespace core {
using decaf::lang::Pointer;
- using activemq::commands::MessageDispatch;
/**
* Interface for an object responsible for dispatching messages to
@@ -35,7 +34,7 @@ namespace core {
class AMQCPP_API Dispatcher {
public:
- virtual ~Dispatcher(){}
+ virtual ~Dispatcher();
/**
* Dispatches a message to a particular consumer.
@@ -43,7 +42,7 @@ namespace core {
* @param message
* The message to be dispatched to a waiting consumer.
*/
- virtual void dispatch(const Pointer<MessageDispatch>& message) = 0;
+ virtual void dispatch(const Pointer<commands::MessageDispatch>& message) = 0;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.cpp Thu Oct 18 15:35:22 2012
@@ -28,7 +28,7 @@ using namespace decaf::util;
using namespace decaf::util::concurrent;
////////////////////////////////////////////////////////////////////////////////
-FifoMessageDispatchChannel::FifoMessageDispatchChannel() : closed( false ), running( false ), channel() {
+FifoMessageDispatchChannel::FifoMessageDispatchChannel() : closed(false), running(false), channel() {
}
////////////////////////////////////////////////////////////////////////////////
@@ -36,24 +36,24 @@ FifoMessageDispatchChannel::~FifoMessage
}
////////////////////////////////////////////////////////////////////////////////
-void FifoMessageDispatchChannel::enqueue( const Pointer<MessageDispatch>& message ) {
- synchronized( &channel ) {
- channel.addLast( message );
+void FifoMessageDispatchChannel::enqueue(const Pointer<MessageDispatch>& message) {
+ synchronized(&channel) {
+ channel.addLast(message);
channel.notify();
}
}
////////////////////////////////////////////////////////////////////////////////
-void FifoMessageDispatchChannel::enqueueFirst( const Pointer<MessageDispatch>& message ) {
- synchronized( &channel ) {
- channel.addFirst( message );
+void FifoMessageDispatchChannel::enqueueFirst(const Pointer<MessageDispatch>& message) {
+ synchronized(&channel) {
+ channel.addFirst(message);
channel.notify();
}
}
////////////////////////////////////////////////////////////////////////////////
bool FifoMessageDispatchChannel::isEmpty() const {
- synchronized( &channel ) {
+ synchronized(&channel) {
return channel.isEmpty();
}
@@ -61,20 +61,20 @@ bool FifoMessageDispatchChannel::isEmpty
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<MessageDispatch> FifoMessageDispatchChannel::dequeue( long long timeout ) {
+Pointer<MessageDispatch> FifoMessageDispatchChannel::dequeue(long long timeout) {
- synchronized( &channel ) {
+ synchronized(&channel) {
// Wait until the channel is ready to deliver messages.
- while( timeout != 0 && !closed && ( channel.isEmpty() || !running ) ) {
- if( timeout == -1 ) {
+ while (timeout != 0 && !closed && (channel.isEmpty() || !running)) {
+ if (timeout == -1) {
channel.wait();
} else {
- channel.wait( (unsigned long)timeout );
+ channel.wait((unsigned long) timeout);
break;
}
}
- if( closed || !running || channel.isEmpty() ) {
+ if (closed || !running || channel.isEmpty()) {
return Pointer<MessageDispatch>();
}
@@ -86,8 +86,8 @@ Pointer<MessageDispatch> FifoMessageDisp
////////////////////////////////////////////////////////////////////////////////
Pointer<MessageDispatch> FifoMessageDispatchChannel::dequeueNoWait() {
- synchronized( &channel ) {
- if( closed || !running || channel.isEmpty() ) {
+ synchronized(&channel) {
+ if (closed || !running || channel.isEmpty()) {
return Pointer<MessageDispatch>();
}
return channel.pop();
@@ -98,8 +98,8 @@ Pointer<MessageDispatch> FifoMessageDisp
////////////////////////////////////////////////////////////////////////////////
Pointer<MessageDispatch> FifoMessageDispatchChannel::peek() const {
- synchronized( &channel ) {
- if( closed || !running || channel.isEmpty() ) {
+ synchronized(&channel) {
+ if (closed || !running || channel.isEmpty()) {
return Pointer<MessageDispatch>();
}
return channel.getFirst();
@@ -110,8 +110,8 @@ Pointer<MessageDispatch> FifoMessageDisp
////////////////////////////////////////////////////////////////////////////////
void FifoMessageDispatchChannel::start() {
- synchronized( &channel ) {
- if( !closed ) {
+ synchronized(&channel) {
+ if (!closed) {
running = true;
channel.notifyAll();
}
@@ -120,7 +120,7 @@ void FifoMessageDispatchChannel::start()
////////////////////////////////////////////////////////////////////////////////
void FifoMessageDispatchChannel::stop() {
- synchronized( &channel ) {
+ synchronized(&channel) {
running = false;
channel.notifyAll();
}
@@ -128,8 +128,8 @@ void FifoMessageDispatchChannel::stop()
////////////////////////////////////////////////////////////////////////////////
void FifoMessageDispatchChannel::close() {
- synchronized( &channel ) {
- if( !closed ) {
+ synchronized(&channel) {
+ if (!closed) {
running = false;
closed = true;
}
@@ -139,25 +139,25 @@ void FifoMessageDispatchChannel::close()
////////////////////////////////////////////////////////////////////////////////
void FifoMessageDispatchChannel::clear() {
- synchronized( &channel ) {
+ synchronized(&channel) {
channel.clear();
}
}
////////////////////////////////////////////////////////////////////////////////
int FifoMessageDispatchChannel::size() const {
- synchronized( &channel ) {
- return (int)channel.size();
+ synchronized(&channel) {
+ return (int) channel.size();
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
-std::vector< Pointer<MessageDispatch> > FifoMessageDispatchChannel::removeAll() {
- std::vector< Pointer<MessageDispatch> > result;
+std::vector<Pointer<MessageDispatch> > FifoMessageDispatchChannel::removeAll() {
+ std::vector<Pointer<MessageDispatch> > result;
- synchronized( &channel ) {
+ synchronized(&channel) {
result = channel.toArray();
channel.clear();
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/FifoMessageDispatchChannel.h Thu Oct 18 15:35:22 2012
@@ -37,8 +37,8 @@ namespace core {
private:
- FifoMessageDispatchChannel( const FifoMessageDispatchChannel& );
- FifoMessageDispatchChannel& operator= ( const FifoMessageDispatchChannel& );
+ FifoMessageDispatchChannel(const FifoMessageDispatchChannel&);
+ FifoMessageDispatchChannel& operator=(const FifoMessageDispatchChannel&);
public:
@@ -46,9 +46,9 @@ namespace core {
virtual ~FifoMessageDispatchChannel();
- virtual void enqueue( const Pointer<MessageDispatch>& message );
+ virtual void enqueue(const Pointer<MessageDispatch>& message);
- virtual void enqueueFirst( const Pointer<MessageDispatch>& message );
+ virtual void enqueueFirst(const Pointer<MessageDispatch>& message);
virtual bool isEmpty() const;
@@ -60,7 +60,7 @@ namespace core {
return this->running;
}
- virtual Pointer<MessageDispatch> dequeue( long long timeout );
+ virtual Pointer<MessageDispatch> dequeue(long long timeout);
virtual Pointer<MessageDispatch> dequeueNoWait();
@@ -76,55 +76,39 @@ namespace core {
virtual int size() const;
- virtual std::vector< Pointer<MessageDispatch> > removeAll();
+ virtual std::vector<Pointer<MessageDispatch> > removeAll();
public:
- virtual void lock() throw( decaf::lang::exceptions::RuntimeException ) {
+ virtual void lock() {
channel.lock();
}
- virtual bool tryLock() throw( decaf::lang::exceptions::RuntimeException ) {
+ virtual bool tryLock() {
return channel.tryLock();
}
- virtual void unlock() throw( decaf::lang::exceptions::RuntimeException ) {
+ virtual void unlock() {
channel.unlock();
}
- virtual void wait() throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException,
- decaf::lang::exceptions::InterruptedException ) {
-
+ virtual void wait() {
channel.wait();
}
- virtual void wait( long long millisecs )
- throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException,
- decaf::lang::exceptions::InterruptedException ) {
-
- channel.wait( millisecs );
+ virtual void wait(long long millisecs) {
+ channel.wait(millisecs);
}
- virtual void wait( long long millisecs, int nanos )
- throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalArgumentException,
- decaf::lang::exceptions::IllegalMonitorStateException,
- decaf::lang::exceptions::InterruptedException ) {
-
- channel.wait( millisecs, nanos );
+ virtual void wait(long long millisecs, int nanos) {
+ channel.wait(millisecs, nanos);
}
- virtual void notify() throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException ) {
-
+ virtual void notify() {
channel.notify();
}
- virtual void notifyAll() throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException ) {
-
+ virtual void notifyAll() {
channel.notifyAll();
}
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MessageDispatchChannel.h"
+
+using namespace activemq;
+using namespace activemq::core;
+
+////////////////////////////////////////////////////////////////////////////////
+MessageDispatchChannel::~MessageDispatchChannel() {}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/MessageDispatchChannel.h Thu Oct 18 15:35:22 2012
@@ -31,24 +31,24 @@ namespace core {
using decaf::lang::Pointer;
using activemq::commands::MessageDispatch;
- class AMQCPP_API MessageDispatchChannel : public decaf::util::concurrent::Synchronizable {
+ class AMQCPP_API MessageDispatchChannel: public decaf::util::concurrent::Synchronizable {
public:
- virtual ~MessageDispatchChannel() {}
+ virtual ~MessageDispatchChannel();
/**
* Add a Message to the Channel behind all pending message.
*
* @param message - The message to add to the Channel.
*/
- virtual void enqueue( const Pointer<MessageDispatch>& message ) = 0;
+ virtual void enqueue(const Pointer<MessageDispatch>& message) = 0;
/**
* Add a message to the front of the Channel.
*
* @param message - The Message to add to the front of the Channel.
*/
- virtual void enqueueFirst( const Pointer<MessageDispatch>& message ) = 0;
+ virtual void enqueueFirst(const Pointer<MessageDispatch>& message) = 0;
/**
* @return true if there are no messages in the Channel.
@@ -76,7 +76,7 @@ namespace core {
* @return null if we timeout or if the consumer is closed.
* @throws ActiveMQException
*/
- virtual Pointer<MessageDispatch> dequeue( long long timeout ) = 0;
+ virtual Pointer<MessageDispatch> dequeue(long long timeout) = 0;
/**
* Used to get an enqueued message if there is one queued right now. If there is
@@ -125,7 +125,7 @@ namespace core {
*
* @return a list of Messages that was previously in the Channel.
*/
- virtual std::vector< Pointer<MessageDispatch> > removeAll() = 0;
+ virtual std::vector<Pointer<MessageDispatch> > removeAll() = 0;
};