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 2008/11/12 15:21:51 UTC
svn commit: r713376 [1/2] -
/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/
Author: tabish
Date: Wed Nov 12 06:21:50 2008
New Revision: 713376
URL: http://svn.apache.org/viewvc?rev=713376&view=rev
Log:
Cleanup
Modified:
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedConsumer.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedProducer.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DestinationResolver.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/MessageCreator.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ProducerCallback.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionCallback.h
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionPool.cpp
activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionPool.h
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedConsumer.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedConsumer.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedConsumer.h Wed Nov 12 06:21:50 2008
@@ -29,17 +29,17 @@
*/
class AMQCPP_API CachedConsumer : public cms::MessageConsumer {
private:
-
+
cms::MessageConsumer* consumer;
-
+
public:
-
+
CachedConsumer( cms::MessageConsumer* consumer ) {
this->consumer = consumer;
}
-
+
virtual ~CachedConsumer() {}
-
+
/**
* Does nothing - the real producer resource will be closed
* by the lifecycle manager.
@@ -61,18 +61,19 @@
}
virtual void setMessageListener( cms::MessageListener* listener ) {
- consumer->setMessageListener(listener);
+ consumer->setMessageListener( listener );
}
virtual cms::MessageListener* getMessageListener() const {
return consumer->getMessageListener();
}
- virtual std::string getMessageSelector() const
+ virtual std::string getMessageSelector() const
throw ( cms::CMSException ) {
+
return consumer->getMessageSelector();
}
-
+
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedProducer.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedProducer.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CachedProducer.h Wed Nov 12 06:21:50 2008
@@ -29,17 +29,17 @@
*/
class AMQCPP_API CachedProducer : public cms::MessageProducer {
private:
-
+
cms::MessageProducer* producer;
-
+
public:
-
+
CachedProducer( cms::MessageProducer* producer ) {
this->producer = producer;
}
-
+
virtual ~CachedProducer() {}
-
+
/**
* Does nothing - the real producer resource will be closed
* by the lifecycle manager.
@@ -49,36 +49,41 @@
}
virtual void send( cms::Message* message ) throw ( cms::CMSException ){
- producer->send(message);
+ producer->send( message );
}
- virtual void send( cms::Message* message, int deliveryMode, int priority,
- long long timeToLive) throw ( cms::CMSException ){
- producer->send(message, deliveryMode, priority, timeToLive);
+ virtual void send( cms::Message* message, int deliveryMode,
+ int priority, long long timeToLive )
+ throw ( cms::CMSException ){
+
+ producer->send( message, deliveryMode, priority, timeToLive );
}
-
+
virtual void send( const cms::Destination* destination,
cms::Message* message ) throw ( cms::CMSException ){
- producer->send(destination, message);
+
+ producer->send( destination, message );
}
virtual void send( const cms::Destination* destination,
- cms::Message* message, int deliveryMode, int priority,
- long long timeToLive) throw ( cms::CMSException ){
- producer->send(destination, message, deliveryMode, priority, timeToLive);
+ cms::Message* message, int deliveryMode,
+ int priority, long long timeToLive )
+ throw ( cms::CMSException ){
+
+ producer->send( destination, message, deliveryMode, priority, timeToLive );
}
virtual void setDeliveryMode( int mode ) {
- producer->setDeliveryMode(mode);
+ producer->setDeliveryMode( mode );
}
virtual int getDeliveryMode() const {
return producer->getDeliveryMode();
}
-
+
virtual void setDisableMessageID( bool value ) {
- producer->setDisableMessageID(value);
+ producer->setDisableMessageID( value );
}
virtual bool getDisableMessageID() const {
@@ -86,7 +91,7 @@
}
virtual void setDisableMessageTimeStamp( bool value ) {
- producer->setDisableMessageTimeStamp(value);
+ producer->setDisableMessageTimeStamp( value );
}
virtual bool getDisableMessageTimeStamp() const {
@@ -94,7 +99,7 @@
}
virtual void setPriority( int priority ) {
- producer->setPriority(priority);
+ producer->setPriority( priority );
}
virtual int getPriority() const {
@@ -102,13 +107,13 @@
}
virtual void setTimeToLive( long long time ) {
- producer->setTimeToLive(time);
+ producer->setTimeToLive( time );
}
virtual long long getTimeToLive() const {
return producer->getTimeToLive();
}
-
+
};
}}
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=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.cpp Wed Nov 12 06:21:50 2008
@@ -33,19 +33,19 @@
}
////////////////////////////////////////////////////////////////////////////////
-cms::Connection* CmsAccessor::createConnection()
-throw (cms::CMSException,IllegalStateException) {
-
+cms::Connection* CmsAccessor::createConnection()
+ throw ( cms::CMSException,IllegalStateException ) {
+
try {
-
+
checkConnectionFactory();
-
+
// Create the connection.
cms::Connection* c = getConnectionFactory()->createConnection();
-
+
// Manage the lifecycle of this resource.
- getResourceLifecycleManager()->addConnection(c);
-
+ getResourceLifecycleManager()->addConnection( c );
+
return c;
}
AMQ_CATCH_RETHROW( IllegalStateException )
@@ -54,20 +54,23 @@
}
////////////////////////////////////////////////////////////////////////////////
-cms::Session* CmsAccessor::createSession(cms::Connection* con)
-throw (cms::CMSException,IllegalStateException) {
-
+cms::Session* CmsAccessor::createSession( cms::Connection* con )
+ throw ( cms::CMSException,IllegalStateException ) {
+
try {
+
if( con == NULL ) {
- throw ActiveMQException(__FILE__, __LINE__, "connection object is invalid");
+ throw ActiveMQException(
+ __FILE__, __LINE__,
+ "connection object is invalid" );
}
-
+
// Create the session.
- cms::Session* s = con->createSession(getSessionAcknowledgeMode());
-
+ cms::Session* s = con->createSession( getSessionAcknowledgeMode() );
+
// Manage the lifecycle of this resource.
- getResourceLifecycleManager()->addSession(s);
-
+ getResourceLifecycleManager()->addSession( s );
+
return s;
}
AMQ_CATCH_RETHROW( IllegalStateException )
@@ -76,11 +79,10 @@
}
////////////////////////////////////////////////////////////////////////////////
-void CmsAccessor::checkConnectionFactory() throw (IllegalStateException) {
- if (getConnectionFactory() == NULL) {
- throw IllegalStateException(
- __FILE__, __LINE__,
- "Property 'connectionFactory' is required");
+void CmsAccessor::checkConnectionFactory() throw ( IllegalStateException ) {
+ if( getConnectionFactory() == NULL ) {
+ throw IllegalStateException(
+ __FILE__, __LINE__,
+ "Property 'connectionFactory' is required" );
}
}
-
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsAccessor.h Wed Nov 12 06:21:50 2008
@@ -33,41 +33,40 @@
* adds further, destination-related properties.
*
* <p>Not intended to be used directly.
- *
+ *
* @see activemq.cms.CmsDestinationAccessor
* @see activemq.cms.CmsTemplate
*/
class AMQCPP_API CmsAccessor {
-
private:
-
+
ResourceLifecycleManager resourceLifecycleManager;
-
+
cms::ConnectionFactory* connectionFactory;
-
+
cms::Session::AcknowledgeMode sessionAcknowledgeMode;
-
+
public:
-
+
CmsAccessor();
-
- virtual ~CmsAccessor();
-
+
+ virtual ~CmsAccessor();
+
virtual ResourceLifecycleManager* getResourceLifecycleManager() {
return &resourceLifecycleManager;
}
-
+
virtual const ResourceLifecycleManager* getResourceLifecycleManager() const {
return &resourceLifecycleManager;
}
-
+
/**
* Set the ConnectionFactory to use for obtaining CMS Connections.
*/
- virtual void setConnectionFactory(cms::ConnectionFactory* connectionFactory) {
+ virtual void setConnectionFactory( cms::ConnectionFactory* connectionFactory ) {
this->connectionFactory = connectionFactory;
}
-
+
/**
* Return the ConnectionFactory that this accessor uses for
* obtaining CMS Connections.
@@ -75,7 +74,7 @@
virtual const cms::ConnectionFactory* getConnectionFactory() const {
return this->connectionFactory;
}
-
+
/**
* Return the ConnectionFactory that this accessor uses for
* obtaining CMS Connections.
@@ -83,66 +82,66 @@
virtual cms::ConnectionFactory* getConnectionFactory() {
return this->connectionFactory;
}
-
+
/**
- * Set the CMS acknowledgement mode that is used when creating a CMS
+ * Set the CMS acknowledgment mode that is used when creating a CMS
* Session to send a message.
* <p>Default is <code>AUTO_ACKNOWLEDGE</code>.
- * @param sessionAcknowledgeMode the acknowledgement mode
+ * @param sessionAcknowledgeMode the acknowledgment mode
*/
virtual void setSessionAcknowledgeMode(
- cms::Session::AcknowledgeMode sessionAcknowledgeMode) {
+ cms::Session::AcknowledgeMode sessionAcknowledgeMode ) {
this->sessionAcknowledgeMode = sessionAcknowledgeMode;
}
-
+
/**
- * Return the acknowledgement mode for CMS sessions.
- * @return the acknowledgement mode applied by this accessor
+ * Return the acknowledgment mode for CMS sessions.
+ * @return the acknowledgment mode applied by this accessor
*/
virtual cms::Session::AcknowledgeMode getSessionAcknowledgeMode() const {
return this->sessionAcknowledgeMode;
}
-
+
protected:
-
+
/**
* Initializes this object and prepares it for use. This should be called
- * before any other methds are called. This version does nothing.
+ * before any other methods are called. This version does nothing.
*/
- virtual void init()
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException) {
- }
-
+ virtual void init()
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException ) {}
+
/**
* Shuts down this object and destroys any allocated resources.
*/
- virtual void destroy()
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException) {
+ virtual void destroy()
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException ) {
resourceLifecycleManager.destroy();
}
-
+
/**
* Create a CMS Connection via this template's ConnectionFactory.
* @return the new CMS Connection
* @throws cms::CMSException if thrown by CMS API methods
*/
- virtual cms::Connection* createConnection()
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-
+ virtual cms::Connection* createConnection()
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException );
+
/**
* Create a CMS Session for the given Connection.
* @param con the CMS Connection to create a Session for
* @return the new CMS Session
* @throws cms::CMSException if thrown by CMS API methods
*/
- virtual cms::Session* createSession(cms::Connection* con)
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-
+ virtual cms::Session* createSession( cms::Connection* con )
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException );
+
/**
* Verifies that the connection factory is valid.
*/
- virtual void checkConnectionFactory() throw (decaf::lang::exceptions::IllegalStateException);
-
+ virtual void checkConnectionFactory()
+ throw ( decaf::lang::exceptions::IllegalStateException );
+
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.cpp?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.cpp Wed Nov 12 06:21:50 2008
@@ -22,63 +22,61 @@
////////////////////////////////////////////////////////////////////////////////
CmsDestinationAccessor::CmsDestinationAccessor() {
-
+
// Default to using queues.
pubSubDomain = false;
-
+
// Start with the default destinationResolver.
destinationResolver = &defaultDestinationResolver;
}
////////////////////////////////////////////////////////////////////////////////
-CmsDestinationAccessor::~CmsDestinationAccessor() {
+CmsDestinationAccessor::~CmsDestinationAccessor() {
}
////////////////////////////////////////////////////////////////////////////////
-void CmsDestinationAccessor::init()
-throw (cms::CMSException, IllegalStateException) {
-
+void CmsDestinationAccessor::init()
+ throw ( cms::CMSException, IllegalStateException ) {
+
CmsAccessor::init();
-
+
// Make sure we have a destination resolver.
checkDestinationResolver();
-
+
// Give the resolver our lifecycle manager.
- destinationResolver->init(getResourceLifecycleManager());
+ destinationResolver->init( getResourceLifecycleManager() );
}
////////////////////////////////////////////////////////////////////////////////
-void CmsDestinationAccessor::destroy()
-throw (cms::CMSException, IllegalStateException) {
-
+void CmsDestinationAccessor::destroy()
+ throw ( cms::CMSException, IllegalStateException ) {
+
if( destinationResolver != NULL ) {
destinationResolver->destroy();
- }
-
+ }
+
CmsAccessor::destroy();
}
-
+
////////////////////////////////////////////////////////////////////////////////
-cms::Destination* CmsDestinationAccessor::resolveDestinationName(
- cms::Session* session,
- const std::string& destName )
-throw (cms::CMSException, IllegalStateException) {
-
+cms::Destination* CmsDestinationAccessor::resolveDestinationName(
+ cms::Session* session,
+ const std::string& destName )
+ throw ( cms::CMSException, IllegalStateException ) {
+
checkDestinationResolver();
-
- return getDestinationResolver()->resolveDestinationName(session,
- destName,
- isPubSubDomain());
+
+ return getDestinationResolver()->resolveDestinationName(
+ session, destName, isPubSubDomain() );
}
////////////////////////////////////////////////////////////////////////////////
-void CmsDestinationAccessor::checkDestinationResolver() throw (IllegalStateException) {
- if (getDestinationResolver() == NULL) {
- throw IllegalStateException(
- __FILE__, __LINE__,
- "Property 'destinationResolver' is required");
+void CmsDestinationAccessor::checkDestinationResolver()
+ throw ( IllegalStateException ) {
+
+ if( getDestinationResolver() == NULL ) {
+ throw IllegalStateException(
+ __FILE__, __LINE__,
+ "Property 'destinationResolver' is required" );
}
}
-
-
-
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsDestinationAccessor.h Wed Nov 12 06:21:50 2008
@@ -26,71 +26,70 @@
/**
* Extends the <code>CmsAccessor</code> to add support for resolving destination names.
- *
+ *
* <p>Not intended to be used directly.
- *
+ *
* @see CmsTemplate
* @see CmsAccessor
*/
class AMQCPP_API CmsDestinationAccessor : public CmsAccessor {
-
private:
-
+
/**
* The default destination resolver.
*/
DynamicDestinationResolver defaultDestinationResolver;
-
+
/**
* The destination resolver to use.
*/
DestinationResolver* destinationResolver;
-
+
/**
* Determines whether to use topics or queues by default.
*/
bool pubSubDomain;
-
+
public:
-
+
CmsDestinationAccessor();
-
- virtual ~CmsDestinationAccessor();
-
+
+ virtual ~CmsDestinationAccessor();
+
virtual bool isPubSubDomain() const {
return this->pubSubDomain;
}
-
+
virtual void setPubSubDomain( bool pubSubDomain ) {
this->pubSubDomain = pubSubDomain;
}
-
+
virtual DestinationResolver* getDestinationResolver() {
return destinationResolver;
}
-
+
virtual const DestinationResolver* getDestinationResolver() const {
return destinationResolver;
}
-
+
virtual void setDestinationResolver( DestinationResolver* destRes ) {
- this->destinationResolver = destRes;
+ this->destinationResolver = destRes;
}
-
+
protected:
-
+
/**
* Initializes the destination resolver.
*/
- virtual void init()
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-
+ virtual void init()
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException );
+
/**
* Calls destroy() on the destination resolver.
*/
- virtual void destroy()
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-
+ virtual void destroy()
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException );
+
/**
* Resolves the destination via the <code>DestinationResolver</code>.
* @param session
@@ -99,18 +98,20 @@
* the name of the destination.
* @return the destination
* @throws cms::CMSException if resolution failed.
- * @throws decaf::lang::exceptions::IllegalStateException if the destiation
+ * @throws decaf::lang::exceptions::IllegalStateException if the destination
* resolver property is NULL.
*/
- virtual cms::Destination* resolveDestinationName(
- cms::Session* session,
- const std::string& destName )
- throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-
+ virtual cms::Destination* resolveDestinationName(
+ cms::Session* session,
+ const std::string& destName )
+ throw ( cms::CMSException, decaf::lang::exceptions::IllegalStateException );
+
/**
* Verifies that the destination resolver is valid.
*/
- virtual void checkDestinationResolver() throw (decaf::lang::exceptions::IllegalStateException);
+ virtual void checkDestinationResolver()
+ throw ( decaf::lang::exceptions::IllegalStateException );
+
};
}}
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=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp Wed Nov 12 06:21:50 2008
@@ -30,9 +30,9 @@
/**
* Macro for catching an exception then rethrowing an
* ActiveMQException (which is a cms::CMSException).
- * @param type
+ * @param type
* The type of the exception to throw
- * @param t
+ * @param t
* The instance of CmsTemplate
* (e.g. ActiveMQException ).
*/
@@ -47,7 +47,7 @@
/**
* A catch-all that throws an ActiveMQException.
- * @param t
+ * @param t
* The instance of CmsTemplate
*/
#define CMSTEMPLATE_CATCHALL(t) \
@@ -66,14 +66,14 @@
}
////////////////////////////////////////////////////////////////////////////////
-CmsTemplate::CmsTemplate(cms::ConnectionFactory* connectionFactory) {
+CmsTemplate::CmsTemplate( cms::ConnectionFactory* connectionFactory ) {
initDefaults();
setConnectionFactory(connectionFactory);
}
////////////////////////////////////////////////////////////////////////////////
CmsTemplate::~CmsTemplate() {
-
+
try {
destroy();
} catch( ... ) { /* Absorb */ }
@@ -92,39 +92,39 @@
deliveryMode = cms::DeliveryMode::PERSISTENT;
priority = DEFAULT_PRIORITY;
timeToLive = DEFAULT_TIME_TO_LIVE;
-
+
// Initialize the connection object.
connection = NULL;
-
+
// Initialize the session pools.
- for( int ix=0; ix<NUM_SESSION_POOLS; ++ix) {
+ for( int ix=0; ix<NUM_SESSION_POOLS; ++ix ) {
sessionPools[ix] = NULL;
}
}
////////////////////////////////////////////////////////////////////////////////
void CmsTemplate::createSessionPools() {
-
+
// Make sure they're destroyed first.
destroySessionPools();
-
+
/**
* Create the session pools.
*/
- for( int ix=0; ix<NUM_SESSION_POOLS; ++ix) {
- sessionPools[ix] = new SessionPool(connection,
- (cms::Session::AcknowledgeMode)ix,
- getResourceLifecycleManager());
+ for( int ix=0; ix<NUM_SESSION_POOLS; ++ix ) {
+ sessionPools[ix] = new SessionPool( connection,
+ ( cms::Session::AcknowledgeMode )ix,
+ getResourceLifecycleManager() );
}
}
////////////////////////////////////////////////////////////////////////////////
void CmsTemplate::destroySessionPools() {
-
+
/**
* Destroy the session pools.
*/
- for( int ix=0; ix<NUM_SESSION_POOLS; ++ix) {
+ for( int ix=0; ix<NUM_SESSION_POOLS; ++ix ) {
if( sessionPools[ix] != NULL ) {
delete sessionPools[ix];
sessionPools[ix] = NULL;
@@ -133,255 +133,255 @@
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::init() throw (cms::CMSException, IllegalStateException) {
+void CmsTemplate::init() throw ( cms::CMSException, IllegalStateException ) {
try {
-
+
if( !initialized ) {
-
+
// Invoke the base class.
CmsDestinationAccessor::init();
-
+
initialized = true;
}
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCH( IllegalStateException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::destroy() throw (cms::CMSException, IllegalStateException) {
-
+void CmsTemplate::destroy() throw ( cms::CMSException, IllegalStateException ) {
+
try {
-
+
// Mark as not initialized.
initialized = false;
-
+
// Clear the connection reference
connection = NULL;
-
+
// Clear the reference to the default destination.
defaultDestination = NULL;
-
+
// Destroy the session pools.
destroySessionPools();
-
+
// Call the base class.
- CmsDestinationAccessor::destroy();
+ CmsDestinationAccessor::destroy();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCH( IllegalStateException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::checkDefaultDestination() throw (IllegalStateException) {
- if (this->defaultDestination == NULL && this->defaultDestinationName.size()==0) {
+void CmsTemplate::checkDefaultDestination() throw ( IllegalStateException ) {
+ if( this->defaultDestination == NULL && this->defaultDestinationName.size()==0 ) {
throw IllegalStateException(
- __FILE__, __LINE__,
- "No defaultDestination or defaultDestinationName specified. Check configuration of CmsTemplate.");
+ __FILE__, __LINE__,
+ "No defaultDestination or defaultDestinationName specified."
+ "Check configuration of CmsTemplate." );
}
}
////////////////////////////////////////////////////////////////////////////////
-cms::Destination* CmsTemplate::resolveDefaultDestination(cms::Session* session)
-throw (cms::CMSException) {
-
+cms::Destination* CmsTemplate::resolveDefaultDestination( cms::Session* session )
+ throw ( cms::CMSException ) {
+
try {
-
+
// Make sure we have a default - otherwise throw.
checkDefaultDestination();
-
+
// First, check the destination object.
cms::Destination* dest = getDefaultDestination();
-
+
// If no default object was provided, the name was provided. Resolve
// the name and then set the destination object so we don't have to
// do this next time.
if( dest == NULL ) {
- dest = resolveDestinationName(session, getDefaultDestinationName());
- setDefaultDestination(dest);
+ dest = resolveDestinationName( session, getDefaultDestinationName() );
+ setDefaultDestination( dest );
}
-
+
return dest;
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCH( IllegalStateException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Connection* CmsTemplate::getConnection()
-throw (cms::CMSException) {
+cms::Connection* CmsTemplate::getConnection()
+ throw ( cms::CMSException ) {
try {
-
+
// If we don't have a connection, create one.
if( connection == NULL ) {
-
+
// Invoke the base class to create the connection and add it
// to the resource lifecycle manager.
connection = createConnection();
-
+
// Start the connection.
connection->start();
-
+
// Create the session pools, passing in this connection.
createSessionPools();
}
-
+
return connection;
}
CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-PooledSession* CmsTemplate::takeSession()
-throw (cms::CMSException) {
+PooledSession* CmsTemplate::takeSession()
+ throw ( cms::CMSException ) {
try {
-
+
// Get the connection resource to verify that the connection and session
// pools have been allocated.
getConnection();
-
+
// Take a session from the pool.
- return sessionPools[getSessionAcknowledgeMode()]->takeSession();
+ return sessionPools[getSessionAcknowledgeMode()]->takeSession();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::returnSession( PooledSession*& session )
-throw (cms::CMSException) {
+void CmsTemplate::returnSession( PooledSession*& session )
+ throw ( cms::CMSException ) {
try {
if( session == NULL ) {
return;
}
-
+
// Close the session, but do not delete since it's a pooled session
session->close();
session = NULL;
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::MessageProducer* CmsTemplate::createProducer(cms::Session* session,
- cms::Destination* dest) throw (cms::CMSException) {
+cms::MessageProducer* CmsTemplate::createProducer(
+ cms::Session* session, cms::Destination* dest) throw ( cms::CMSException ) {
try {
// If no destination was provided, resolve the default.
if( dest == NULL ) {
- dest = resolveDefaultDestination(session);
+ dest = resolveDefaultDestination( session );
}
-
+
cms::MessageProducer* producer = NULL;
-
+
// Try to use a cached producer - requires that we're using a
// PooledSession
- PooledSession* pooledSession = dynamic_cast<PooledSession*>(session);
+ PooledSession* pooledSession = dynamic_cast<PooledSession*>( session );
if( pooledSession != NULL ) {
- producer = pooledSession->createCachedProducer(dest);
+ producer = pooledSession->createCachedProducer( dest );
} else {
- producer = session->createProducer(dest);
+ producer = session->createProducer( dest );
}
-
+
// Set the default values on the producer.
- producer->setDisableMessageID(!isMessageIdEnabled());
- producer->setDisableMessageTimeStamp(!isMessageTimestampEnabled());
+ producer->setDisableMessageID( !isMessageIdEnabled() );
+ producer->setDisableMessageTimeStamp( !isMessageTimestampEnabled() );
return producer;
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCH( IllegalStateException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::MessageConsumer* CmsTemplate::createConsumer(cms::Session* session,
- cms::Destination* dest,
- const std::string& selector,
- bool noLocal ) throw (cms::CMSException) {
+cms::MessageConsumer* CmsTemplate::createConsumer(
+ cms::Session* session, cms::Destination* dest, const std::string& selector, bool noLocal )
+ throw ( cms::CMSException ) {
try {
// If no destination was provided, resolve the default.
- if( dest == NULL ) {
- dest = resolveDefaultDestination(session);
+ if( dest == NULL ) {
+ dest = resolveDefaultDestination( session );
}
-
+
cms::MessageConsumer* consumer = NULL;
-
+
// Try to use a cached consumer - requires that we're using a
// PooledSession
- PooledSession* pooledSession = dynamic_cast<PooledSession*>(session);
+ PooledSession* pooledSession = dynamic_cast<PooledSession*>( session );
if( pooledSession != NULL ) {
- consumer = pooledSession->createCachedConsumer(dest, selector, noLocal);
+ consumer = pooledSession->createCachedConsumer( dest, selector, noLocal );
} else {
- consumer = session->createConsumer(dest, selector, noLocal);
+ consumer = session->createConsumer( dest, selector, noLocal );
}
return consumer;
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
CMSTEMPLATE_CATCH( IllegalStateException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::destroyProducer( cms::MessageProducer*& producer)
-throw (cms::CMSException) {
+void CmsTemplate::destroyProducer( cms::MessageProducer*& producer )
+ throw ( cms::CMSException ) {
if( producer == NULL ) {
return;
}
-
- try {
-
+
+ try {
+
// Close the producer, then destroy it.
- producer->close();
+ producer->close();
}
AMQ_CATCH_NOTHROW( cms::CMSException )
-
+
// Destroy if it's not a cached producer.
- CachedProducer* cachedProducer = dynamic_cast<CachedProducer*>(producer);
+ CachedProducer* cachedProducer = dynamic_cast<CachedProducer*>( producer );
if( cachedProducer == NULL ) {
delete producer;
}
-
+
producer = NULL;
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::destroyConsumer( cms::MessageConsumer*& consumer)
-throw (cms::CMSException) {
+void CmsTemplate::destroyConsumer( cms::MessageConsumer*& consumer )
+ throw ( cms::CMSException ) {
if( consumer == NULL ) {
return;
}
-
- try {
-
+
+ try {
+
// Close the producer, then destroy it.
- consumer->close();
+ consumer->close();
}
AMQ_CATCH_NOTHROW( cms::CMSException )
-
+
// Destroy if it's not a cached consumer.
- CachedConsumer* cachedConsumer = dynamic_cast<CachedConsumer*>(consumer);
+ CachedConsumer* cachedConsumer = dynamic_cast<CachedConsumer*>( consumer );
if( cachedConsumer == NULL ) {
delete consumer;
}
-
+
consumer = NULL;
}
@@ -391,224 +391,223 @@
if( message == NULL ) {
return;
}
-
- // Destroy the message.
+
+ // Destroy the message.
delete message;
message = NULL;
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::execute(SessionCallback* action) throw (cms::CMSException) {
-
+void CmsTemplate::execute( SessionCallback* action ) throw ( cms::CMSException ) {
+
PooledSession* pooledSession = NULL;
-
+
try {
-
+
if( action == NULL ) {
return;
}
-
+
// Verify that we are initialized
init();
-
+
// Take a session from the pool.
pooledSession = takeSession();
-
+
// Execute the action with the given session.
- action->doInCms(pooledSession);
-
+ action->doInCms( pooledSession );
+
// Return the session to the pool.
- returnSession(pooledSession);
+ returnSession( pooledSession );
}
CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::execute(ProducerCallback* action) throw (cms::CMSException) {
-
+void CmsTemplate::execute( ProducerCallback* action ) throw ( cms::CMSException ) {
+
try {
-
+
// Verify that we are initialized
init();
-
+
// Create the callback with using default destination.
- ProducerExecutor cb(action, this, NULL);
-
+ ProducerExecutor cb( action, this, NULL );
+
// Execute the action in a session.
- execute(&cb);
+ execute( &cb );
}
CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::execute(cms::Destination* dest,
- ProducerCallback* action) throw (cms::CMSException) {
-
+void CmsTemplate::execute( cms::Destination* dest, ProducerCallback* action )
+ throw ( cms::CMSException ) {
+
try {
-
+
// Verify that we are initialized
init();
-
+
// Create the callback.
- ProducerExecutor cb(action, this, dest);
-
+ ProducerExecutor cb( action, this, dest );
+
// Execute the action in a session.
- execute(&cb);
+ execute( &cb );
}
CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::execute(const std::string& destinationName,
- ProducerCallback* action) throw (cms::CMSException) {
-
+void CmsTemplate::execute( const std::string& destinationName, ProducerCallback* action )
+ throw ( cms::CMSException ) {
+
try {
-
+
// Verify that we are initialized
init();
-
+
// Create the callback.
- ResolveProducerExecutor cb(action, this, destinationName);
-
+ ResolveProducerExecutor cb( action, this, destinationName );
+
// Execute the action in a session.
- execute(&cb);
+ execute( &cb );
}
CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::ProducerExecutor::doInCms( cms::Session* session )
-throw (cms::CMSException) {
-
+void CmsTemplate::ProducerExecutor::doInCms( cms::Session* session )
+ throw ( cms::CMSException ) {
+
cms::MessageProducer* producer = NULL;
-
+
try {
-
+
if( session == NULL ) {
return;
}
-
+
// Create the producer.
- producer = parent->createProducer(session, getDestination(session));
-
+ producer = parent->createProducer( session, getDestination( session ) );
+
// Execute the action.
- action->doInCms(session, producer);
-
+ action->doInCms( session, producer );
+
// Destroy the producer.
- parent->destroyProducer(producer);
-
+ parent->destroyProducer( producer );
+
}
CMSTEMPLATE_CATCH( ActiveMQException, parent )
- CMSTEMPLATE_CATCHALL(parent)
+ CMSTEMPLATE_CATCHALL( parent )
}
////////////////////////////////////////////////////////////////////////////////
cms::Destination* CmsTemplate::ResolveProducerExecutor::getDestination(
- cms::Session* session )
- throw (cms::CMSException) {
-
- try {
- return parent->resolveDestinationName(session, destinationName);
+ cms::Session* session ) throw ( cms::CMSException ) {
+
+ try {
+ return parent->resolveDestinationName( session, destinationName );
}
CMSTEMPLATE_CATCH( ActiveMQException, parent )
CMSTEMPLATE_CATCH( IllegalStateException, parent )
- CMSTEMPLATE_CATCHALL(parent)
+ CMSTEMPLATE_CATCHALL( parent )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::send(MessageCreator* messageCreator)
-throw (cms::CMSException) {
-
+void CmsTemplate::send( MessageCreator* messageCreator )
+ throw ( cms::CMSException ) {
+
try {
- SendExecutor senderExecutor(messageCreator, this);
- execute(&senderExecutor);
+ SendExecutor senderExecutor( messageCreator, this );
+ execute( &senderExecutor );
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::send(cms::Destination* dest,
- MessageCreator* messageCreator)
-throw (cms::CMSException) {
-
- try {
- SendExecutor senderExecutor(messageCreator, this);
- execute(dest, &senderExecutor);
+void CmsTemplate::send( cms::Destination* dest, MessageCreator* messageCreator )
+ throw ( cms::CMSException ) {
+
+ try {
+ SendExecutor senderExecutor( messageCreator, this );
+ execute( dest, &senderExecutor );
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
-
+
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::send(const std::string& destinationName,
- MessageCreator* messageCreator)
-throw (cms::CMSException) {
-
+void CmsTemplate::send( const std::string& destinationName,
+ MessageCreator* messageCreator )
+ throw ( cms::CMSException ) {
+
try {
- SendExecutor senderExecutor(messageCreator, this);
- execute(destinationName, &senderExecutor);
+ SendExecutor senderExecutor( messageCreator, this );
+ execute( destinationName, &senderExecutor );
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
-
+
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::doSend(cms::Session* session, cms::MessageProducer* producer,
- MessageCreator* messageCreator) throw (cms::CMSException) {
-
+void CmsTemplate::doSend( cms::Session* session,
+ cms::MessageProducer* producer,
+ MessageCreator* messageCreator) throw ( cms::CMSException ) {
+
cms::Message* message = NULL;
-
+
try {
-
+
if( producer == NULL ) {
return;
- }
-
+ }
+
// Create the message.
- message = messageCreator->createMessage(session);
-
+ message = messageCreator->createMessage( session );
+
// Send the message.
if( isExplicitQosEnabled() ) {
- producer->send(message, getDeliveryMode(), getPriority(), getTimeToLive());
+ producer->send( message, getDeliveryMode(), getPriority(), getTimeToLive() );
} else {
- producer->send(message);
+ producer->send( message );
}
-
+
// Destroy the resources.
- destroyMessage(message);
-
- } catch( ActiveMQException& e) {
-
+ destroyMessage( message );
+
+ } catch( ActiveMQException& e ) {
+
e.setMark(__FILE__, __LINE__ );
-
+
// Destroy the resources.
- destroyMessage(message);
-
+ destroyMessage( message );
+
throw e;
}
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::doReceive(cms::MessageConsumer* consumer )
-throw (cms::CMSException) {
-
+cms::Message* CmsTemplate::doReceive( cms::MessageConsumer* consumer )
+ throw ( cms::CMSException ) {
+
try {
-
+
if( consumer == NULL ) {
- throw new ActiveMQException(__FILE__, __LINE__, "consumer is NULL");
+ throw new ActiveMQException( __FILE__, __LINE__, "consumer is NULL" );
}
-
+
long long receiveTime = getReceiveTimeout();
-
+
switch( receiveTime ) {
case RECEIVE_TIMEOUT_NO_WAIT: {
return consumer->receiveNoWait();
@@ -617,148 +616,147 @@
return consumer->receive();
}
default: {
- return consumer->receive((int)receiveTime);
+ return consumer->receive( (int)receiveTime );
}
}
-
+
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-void CmsTemplate::ReceiveExecutor::doInCms(cms::Session* session)
- throw (cms::CMSException) {
-
+void CmsTemplate::ReceiveExecutor::doInCms( cms::Session* session )
+ throw ( cms::CMSException ) {
+
cms::MessageConsumer* consumer = NULL;
message = NULL;
-
+
try {
-
+
// Create the consumer resource.
- consumer = parent->createConsumer(session, getDestination(session), selector, noLocal);
-
+ consumer = parent->createConsumer( session, getDestination( session ), selector, noLocal );
+
// Receive the message.
- message = parent->doReceive(consumer);
-
+ message = parent->doReceive( consumer );
+
// Destroy the consumer resource.
- parent->destroyConsumer(consumer);
-
- } catch( ActiveMQException& e) {
-
- e.setMark(__FILE__, __LINE__ );
-
+ parent->destroyConsumer( consumer );
+
+ } catch( ActiveMQException& e ) {
+
+ e.setMark( __FILE__, __LINE__ );
+
// Destroy the message resource.
- parent->destroyMessage(message);
-
+ parent->destroyMessage( message );
+
throw e;
}
}
////////////////////////////////////////////////////////////////////////////////
cms::Destination* CmsTemplate::ResolveReceiveExecutor::getDestination(
- cms::Session* session )
- throw (cms::CMSException) {
-
- try {
- return parent->resolveDestinationName(session, destinationName);
+ cms::Session* session ) throw ( cms::CMSException ) {
+
+ try {
+ return parent->resolveDestinationName( session, destinationName );
}
CMSTEMPLATE_CATCH( ActiveMQException, parent )
CMSTEMPLATE_CATCH( IllegalStateException, parent )
- CMSTEMPLATE_CATCHALL(parent)
+ CMSTEMPLATE_CATCHALL( parent )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::receive()
-throw (cms::CMSException) {
-
- try {
- ReceiveExecutor receiveExecutor(this, NULL,
- "", isNoLocal());
- execute(&receiveExecutor);
-
+cms::Message* CmsTemplate::receive() throw ( cms::CMSException ) {
+
+ try {
+
+ ReceiveExecutor receiveExecutor( this, NULL, "", isNoLocal() );
+ execute( &receiveExecutor );
+
return receiveExecutor.getMessage();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::receive(cms::Destination* destination )
-throw (cms::CMSException) {
-
- try {
- ReceiveExecutor receiveExecutor(this, destination,
- "", isNoLocal());
- execute(&receiveExecutor);
-
+cms::Message* CmsTemplate::receive( cms::Destination* destination )
+ throw ( cms::CMSException ) {
+
+ try {
+
+ ReceiveExecutor receiveExecutor( this, destination, "", isNoLocal() );
+ execute( &receiveExecutor );
+
return receiveExecutor.getMessage();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::receive(const std::string& destinationName)
-throw (cms::CMSException) {
-
- try {
- ResolveReceiveExecutor receiveExecutor(this,
- "", isNoLocal(),
- destinationName);
- execute(&receiveExecutor);
-
+cms::Message* CmsTemplate::receive( const std::string& destinationName )
+ throw ( cms::CMSException ) {
+
+ try {
+
+ ResolveReceiveExecutor receiveExecutor(
+ this, "", isNoLocal(), destinationName );
+ execute( &receiveExecutor );
+
return receiveExecutor.getMessage();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::receiveSelected(const std::string& selector)
-throw (cms::CMSException) {
-
- try {
- ReceiveExecutor receiveExecutor(this, NULL,
- selector, isNoLocal());
- execute(&receiveExecutor);
-
+cms::Message* CmsTemplate::receiveSelected( const std::string& selector )
+ throw ( cms::CMSException ) {
+
+ try {
+
+ ReceiveExecutor receiveExecutor(
+ this, NULL, selector, isNoLocal() );
+ execute( &receiveExecutor );
+
return receiveExecutor.getMessage();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::receiveSelected(cms::Destination* destination,
- const std::string& selector)
-throw (cms::CMSException) {
-
- try {
- ReceiveExecutor receiveExecutor(this, destination,
- selector, isNoLocal());
- execute(&receiveExecutor);
-
+cms::Message* CmsTemplate::receiveSelected( cms::Destination* destination,
+ const std::string& selector )
+ throw ( cms::CMSException ) {
+
+ try {
+
+ ReceiveExecutor receiveExecutor(
+ this, destination, selector, isNoLocal() );
+ execute( &receiveExecutor );
+
return receiveExecutor.getMessage();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
////////////////////////////////////////////////////////////////////////////////
-cms::Message* CmsTemplate::receiveSelected(const std::string& destinationName,
- const std::string& selector)
-throw (cms::CMSException) {
-
- try {
- ResolveReceiveExecutor receiveExecutor(this,
- selector, isNoLocal(),
- destinationName);
- execute(&receiveExecutor);
-
+cms::Message* CmsTemplate::receiveSelected( const std::string& destinationName,
+ const std::string& selector )
+ throw ( cms::CMSException ) {
+
+ try {
+
+ ResolveReceiveExecutor receiveExecutor(
+ this, selector, isNoLocal(), destinationName );
+ execute( &receiveExecutor );
+
return receiveExecutor.getMessage();
}
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL(this)
+ CMSTEMPLATE_CATCHALL( this )
}
-
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h Wed Nov 12 06:21:50 2008
@@ -230,7 +230,7 @@
bool noLocal,
const std::string& destinationName )
:
- ReceiveExecutor( parent, NULL, selector, noLocal) {
+ ReceiveExecutor( parent, NULL, selector, noLocal ) {
this->destinationName = destinationName;
}
@@ -274,7 +274,7 @@
public:
CmsTemplate();
- CmsTemplate(cms::ConnectionFactory* connectionFactory);
+ CmsTemplate( cms::ConnectionFactory* connectionFactory );
virtual ~CmsTemplate();
@@ -505,7 +505,7 @@
* @throws cms::CMSException thrown if an error occurs.
*/
virtual void execute( cms::Destination* dest, ProducerCallback* action )
- throw (cms::CMSException);
+ throw ( cms::CMSException );
/**
* Executes the given action and provides it with a CMS Session and
@@ -714,7 +714,7 @@
* a producer to destroy
* @throws cms::CMSException thrown if the CMS methods throw.
*/
- void destroyProducer( cms::MessageProducer*& producer ) throw (cms::CMSException);
+ void destroyProducer( cms::MessageProducer*& producer ) throw ( cms::CMSException );
/**
* Allocates a consumer initialized with the proper values.
@@ -738,7 +738,7 @@
* a consumer to destroy
* @throws cms::CMSException thrown if the CMS methods throw.
*/
- void destroyConsumer( cms::MessageConsumer*& consumer ) throw (cms::CMSException);
+ void destroyConsumer( cms::MessageConsumer*& consumer ) throw ( cms::CMSException );
/**
* Destroys the given message
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DestinationResolver.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DestinationResolver.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DestinationResolver.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DestinationResolver.h Wed Nov 12 06:21:50 2008
@@ -30,7 +30,6 @@
* Resolves a CMS destination name to a <code>Destination</code>.
*/
class AMQCPP_API DestinationResolver {
-
public:
virtual ~DestinationResolver() {}
@@ -43,7 +42,7 @@
* @param mgr
* the resource lifecycle manager.
*/
- virtual void init( ResourceLifecycleManager* mgr) = 0;
+ virtual void init( ResourceLifecycleManager* mgr ) = 0;
/**
* Destroys any allocated resources.
@@ -67,9 +66,11 @@
* @throws cms::CMSException if resolution failed.
*/
virtual cms::Destination* resolveDestinationName(
- cms::Session* session,
- const std::string& destName,
- bool pubSubDomain ) throw (cms::CMSException) = 0;
+ cms::Session* session,
+ const std::string& destName,
+ bool pubSubDomain )
+ throw ( cms::CMSException ) = 0;
+
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp Wed Nov 12 06:21:50 2008
@@ -26,61 +26,61 @@
////////////////////////////////////////////////////////////////////////////////
cms::Topic* DynamicDestinationResolver::SessionResolver::getTopic(
- const std::string& topicName ) throw (cms::CMSException) {
+ const std::string& topicName ) throw ( cms::CMSException ) {
cms::Topic* topic = NULL;
try {
-
+
// See if we already have a topic with this name.
- topic = topicMap.getValue(topicName);
-
- } catch (decaf::lang::exceptions::NoSuchElementException& ex) {
-
+ topic = topicMap.getValue( topicName );
+
+ } catch ( decaf::lang::exceptions::NoSuchElementException& ex ) {
+
// Create a new topic.
- topic = session->createTopic(topicName);
-
+ topic = session->createTopic( topicName );
+
// Add the topic to the lifecycle manager.
- resourceLifecycleManager->addDestination(topic);
-
+ resourceLifecycleManager->addDestination( topic );
+
// Add the topic to the map.
- topicMap.setValue(topicName, topic);
+ topicMap.setValue( topicName, topic );
}
return topic;
}
////////////////////////////////////////////////////////////////////////////////
cms::Queue* DynamicDestinationResolver::SessionResolver::getQueue(
- const std::string& queueName) throw (cms::CMSException) {
+ const std::string& queueName ) throw ( cms::CMSException ) {
cms::Queue* queue = NULL;
try {
-
+
// See if we already have a queue with this name.
- queue = queueMap.getValue(queueName);
-
- } catch (decaf::lang::exceptions::NoSuchElementException& ex) {
-
+ queue = queueMap.getValue( queueName );
+
+ } catch ( decaf::lang::exceptions::NoSuchElementException& ex ) {
+
// Create a new queue.
- queue = session->createQueue(queueName);
-
+ queue = session->createQueue( queueName );
+
// Add the queue to the lifecycle manager.
- resourceLifecycleManager->addDestination(queue);
-
+ resourceLifecycleManager->addDestination( queue );
+
// Add the queue to the map.
- queueMap.setValue(queueName, queue);
+ queueMap.setValue( queueName, queue );
}
return queue;
}
////////////////////////////////////////////////////////////////////////////////
DynamicDestinationResolver::~DynamicDestinationResolver() {
-
+
destroy();
}
////////////////////////////////////////////////////////////////////////////////
void DynamicDestinationResolver::destroy() {
-
+
// Destroy the session resolvers.
vector<SessionResolver*> r = sessionResolverMap.getValues();
for( size_t ix=0; ix<r.size(); ++ix ) {
@@ -93,24 +93,24 @@
cms::Destination* DynamicDestinationResolver::resolveDestinationName(
cms::Session* session, const std::string& destName, bool pubSubDomain)
throw (cms::CMSException) {
-
+
if( destName == "" ) {
- throw ActiveMQException(__FILE__, __LINE__, "destination name is invalid");
+ throw ActiveMQException( __FILE__, __LINE__, "destination name is invalid" );
}
-
+
// Get the resolver for this session.
SessionResolver* resolver = NULL;
try {
- resolver = sessionResolverMap.getValue(session);
- } catch (decaf::lang::exceptions::NoSuchElementException& ex) {
- resolver = new SessionResolver(session, resourceLifecycleManager);
- sessionResolverMap.setValue(session, resolver);
+ resolver = sessionResolverMap.getValue( session );
+ } catch ( decaf::lang::exceptions::NoSuchElementException& ex ) {
+ resolver = new SessionResolver( session, resourceLifecycleManager );
+ sessionResolverMap.setValue( session, resolver );
}
-
+
// Return the appropriate destination.
if( pubSubDomain ) {
- return resolver->getTopic(destName);
+ return resolver->getTopic( destName );
} else {
- return resolver->getQueue(destName);
+ return resolver->getQueue( destName );
}
}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h Wed Nov 12 06:21:50 2008
@@ -36,6 +36,7 @@
*/
class SessionResolver {
private:
+
ResourceLifecycleManager* resourceLifecycleManager;
cms::Session* session;
decaf::util::Map<std::string, cms::Topic*> topicMap;
@@ -53,10 +54,11 @@
virtual ~SessionResolver() {}
cms::Topic* getTopic(const std::string& topicName )
- throw (cms::CMSException);
+ throw ( cms::CMSException );
cms::Queue* getQueue(const std::string& queueName )
- throw (cms::CMSException);
+ throw ( cms::CMSException );
+
};
/**
@@ -73,7 +75,7 @@
virtual ~DynamicDestinationResolver();
- virtual void init( ResourceLifecycleManager* mgr) {
+ virtual void init( ResourceLifecycleManager* mgr ) {
// since we're changing the lifecycle manager, clear out references
// to old resources.
@@ -101,9 +103,11 @@
* @throws cms::CMSException if resolution failed.
*/
virtual cms::Destination* resolveDestinationName(
- cms::Session* session,
- const std::string& destName,
- bool pubSubDomain ) throw (cms::CMSException);
+ cms::Session* session,
+ const std::string& destName,
+ bool pubSubDomain )
+ throw ( cms::CMSException );
+
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/MessageCreator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/MessageCreator.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/MessageCreator.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/MessageCreator.h Wed Nov 12 06:21:50 2008
@@ -26,26 +26,26 @@
namespace cmsutil {
/**
- * Creates the user-defined message to be sent by the
+ * Creates the user-defined message to be sent by the
* <code>CmsTemplate</code>.
*/
class AMQCPP_API MessageCreator {
public:
-
+
virtual ~MessageCreator(){}
-
+
/**
* Creates a message from the given session.
- *
- * @param session
+ *
+ * @param session
* the CMS <code>Session</code>
* @throws cms::CMSException if thrown by CMS API methods
*/
- virtual cms::Message* createMessage(cms::Session* session )
- throw (cms::CMSException) = 0;
-
+ virtual cms::Message* createMessage( cms::Session* session )
+ throw ( cms::CMSException ) = 0;
+
};
}}
-#endif /*ACTIVEMQ_CMSUTIL_MESSAGECREATOR_H*/
+#endif /*ACTIVEMQ_CMSUTIL_MESSAGECREATOR_H*/
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp Wed Nov 12 06:21:50 2008
@@ -25,21 +25,21 @@
using namespace activemq::exceptions;
////////////////////////////////////////////////////////////////////////////////
-PooledSession::PooledSession(SessionPool* pool, cms::Session* session) {
+PooledSession::PooledSession( SessionPool* pool, cms::Session* session ) {
this->session = session;
this->pool = pool;
}
////////////////////////////////////////////////////////////////////////////////
PooledSession::~PooledSession(){
-
+
// Destroy cached producers.
std::vector<CachedProducer*> cachedProducers = producerCache.getValues();
for( std::size_t ix = 0; ix < cachedProducers.size(); ++ix ) {
delete cachedProducers[ix];
}
cachedProducers.clear();
-
+
// Destroy cached consumers.
std::vector<CachedConsumer*> cachedConsumers = consumerCache.getValues();
for( std::size_t ix = 0; ix < cachedConsumers.size(); ++ix ) {
@@ -50,45 +50,45 @@
////////////////////////////////////////////////////////////////////////////////
void PooledSession::close() throw( cms::CMSException ) {
-
+
if( pool != NULL ) {
- pool->returnSession(this);
+ pool->returnSession( this );
}
}
////////////////////////////////////////////////////////////////////////////////
-cms::MessageProducer* PooledSession::createCachedProducer(
+cms::MessageProducer* PooledSession::createCachedProducer(
const cms::Destination* destination )
throw ( cms::CMSException ) {
-
+
try {
-
+
if( destination == NULL ) {
throw ActiveMQException(__FILE__, __LINE__, "destination is NULL");
}
-
+
std::string key = getUniqueDestName(destination);
-
+
// Check the cache - add it if necessary.
CachedProducer* cachedProducer = NULL;
- try {
- cachedProducer = producerCache.getValue(key);
+ try {
+ cachedProducer = producerCache.getValue( key );
} catch( decaf::lang::exceptions::NoSuchElementException& e ) {
-
+
// No producer exists for this destination - start by creating
// a new producer resource.
- cms::MessageProducer* p = session->createProducer(destination);
-
+ cms::MessageProducer* p = session->createProducer( destination );
+
// Add the producer resource to the resource lifecycle manager.
- pool->getResourceLifecycleManager()->addMessageProducer(p);
-
+ pool->getResourceLifecycleManager()->addMessageProducer( p );
+
// Create the cached producer wrapper.
- cachedProducer = new CachedProducer(p);
-
+ cachedProducer = new CachedProducer( p );
+
// Add it to the cache.
- producerCache.setValue(key, cachedProducer);
+ producerCache.setValue( key, cachedProducer );
}
-
+
return cachedProducer;
}
AMQ_CATCH_RETHROW( ActiveMQException )
@@ -99,41 +99,41 @@
cms::MessageConsumer* PooledSession::createCachedConsumer(
const cms::Destination* destination,
const std::string& selector,
- bool noLocal) throw ( cms::CMSException ) {
-
+ bool noLocal ) throw ( cms::CMSException ) {
+
try {
-
+
if( destination == NULL ) {
- throw ActiveMQException(__FILE__, __LINE__, "destination is NULL");
+ throw ActiveMQException( __FILE__, __LINE__, "destination is NULL" );
}
-
+
// Append the selector and noLocal flag onto the key.
- std::string key = getUniqueDestName(destination);
+ std::string key = getUniqueDestName( destination );
key += "s=";
key += selector;
key += ",nl=";
- key += (noLocal? "t" : "f");
-
+ key += ( noLocal? "t" : "f" );
+
// Check the cache - add it if necessary.
CachedConsumer* cachedConsumer = NULL;
- try {
- cachedConsumer = consumerCache.getValue(key);
+ try {
+ cachedConsumer = consumerCache.getValue( key );
} catch( decaf::lang::exceptions::NoSuchElementException& e ) {
-
+
// No producer exists for this destination - start by creating
// a new consumer resource.
- cms::MessageConsumer* c = session->createConsumer(destination, selector, noLocal);
-
+ cms::MessageConsumer* c = session->createConsumer( destination, selector, noLocal );
+
// Add the consumer resource to the resource lifecycle manager.
- pool->getResourceLifecycleManager()->addMessageConsumer(c);
-
+ pool->getResourceLifecycleManager()->addMessageConsumer( c );
+
// Create the cached consumer wrapper.
- cachedConsumer = new CachedConsumer(c);
-
+ cachedConsumer = new CachedConsumer( c );
+
// Add it to the cache.
- consumerCache.setValue(key, cachedConsumer);
+ consumerCache.setValue( key, cachedConsumer );
}
-
+
return cachedConsumer;
}
AMQ_CATCH_RETHROW( ActiveMQException )
@@ -142,19 +142,19 @@
////////////////////////////////////////////////////////////////////////////////
std::string PooledSession::getUniqueDestName( const cms::Destination* dest ) {
-
+
std::string destName = "[";
- const cms::Queue* queue = dynamic_cast<const cms::Queue*>(dest);
+ const cms::Queue* queue = dynamic_cast<const cms::Queue*>( dest );
if( queue != NULL ) {
destName += "q:" + queue->getQueueName();
} else {
- const cms::Topic* topic = dynamic_cast<const cms::Topic*>(dest);
+ const cms::Topic* topic = dynamic_cast<const cms::Topic*>( dest );
if( topic != NULL ) {
destName += "t:" + topic->getTopicName();
}
}
-
+
destName += "]";
-
+
return destName;
}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h Wed Nov 12 06:21:50 2008
@@ -36,77 +36,77 @@
*/
class AMQCPP_API PooledSession : public cms::Session {
private:
-
+
SessionPool* pool;
-
+
cms::Session* session;
-
+
decaf::util::Map<std::string, CachedProducer*> producerCache;
-
+
decaf::util::Map<std::string, CachedConsumer*> consumerCache;
-
+
public:
-
- PooledSession( SessionPool* pool, cms::Session* session );
-
- /**
- * Does nothing
- */
- virtual ~PooledSession();
- /**
+ PooledSession( SessionPool* pool, cms::Session* session );
+
+ /**
+ * Does nothing
+ */
+ virtual ~PooledSession();
+
+ /**
* Returns a non-constant reference to the internal session object.
- *
+ *
* @return the session object.
*/
- virtual cms::Session* getSession() {
- return session;
- }
-
- /**
- * Returns a constant reference to the internal session object.
- *
- * @return the session object.
- */
- virtual const cms::Session* getSession() const {
+ virtual cms::Session* getSession() {
return session;
}
-
- /**
- * Returns this session back to the pool, but does not close
- * or destroy the internal session object.
- */
+
+ /**
+ * Returns a constant reference to the internal session object.
+ *
+ * @return the session object.
+ */
+ virtual const cms::Session* getSession() const {
+ return session;
+ }
+
+ /**
+ * Returns this session back to the pool, but does not close
+ * or destroy the internal session object.
+ */
virtual void close() throw( cms::CMSException );
-
+
virtual void commit() throw ( cms::CMSException ) {
session->commit();
}
-
+
virtual void rollback() throw ( cms::CMSException ) {
session->rollback();
}
-
+
virtual cms::MessageConsumer* createConsumer(
const cms::Destination* destination )
throw ( cms::CMSException ) {
return session->createConsumer(destination);
}
-
- virtual cms::MessageConsumer* createConsumer(
+
+ virtual cms::MessageConsumer* createConsumer(
const cms::Destination* destination,
const std::string& selector )
throw ( cms::CMSException ) {
return session->createConsumer(destination, selector);
}
-
- virtual cms::MessageConsumer* createConsumer(
+
+ virtual cms::MessageConsumer* createConsumer(
const cms::Destination* destination,
const std::string& selector,
bool noLocal )
throw ( cms::CMSException ) {
return session->createConsumer(destination, selector, noLocal);
}
-
+
virtual cms::MessageConsumer* createDurableConsumer(
const cms::Topic* destination,
const std::string& name,
@@ -115,13 +115,13 @@
throw ( cms::CMSException ) {
return session->createDurableConsumer(destination, name, selector, noLocal);
}
-
+
/**
* First checks the internal consumer cache and creates on if none exist
* for the given destination, selector, noLocal. If created, the consumer is
* added to the pool's lifecycle manager.
- *
- * @param destiation
+ *
+ * @param destination
* the destination to receive on
* @param selector
* the selector to use
@@ -134,17 +134,17 @@
const cms::Destination* destination,
const std::string& selector,
bool noLocal) throw ( cms::CMSException );
-
+
virtual cms::MessageProducer* createProducer( const cms::Destination* destination )
throw ( cms::CMSException ) {
return session->createProducer(destination);
}
-
+
/**
- * First checks the internal producer cache and creates one if none exist
- * for the given destination. If created, the producer is added to the
+ * First checks the internal producer cache and creates one if none exist
+ * for the given destination. If created, the producer is added to the
* pool's lifecycle manager.
- *
+ *
* @param destination
* the destination to send on
* @return the producer resource
@@ -152,15 +152,15 @@
*/
virtual cms::MessageProducer* createCachedProducer( const cms::Destination* destination )
throw ( cms::CMSException );
-
+
virtual cms::Queue* createQueue( const std::string& queueName )
throw ( cms::CMSException ) {
- return session->createQueue(queueName);
+ return session->createQueue( queueName );
}
-
+
virtual cms::Topic* createTopic( const std::string& topicName )
throw ( cms::CMSException ) {
- return session->createTopic(topicName);
+ return session->createTopic( topicName );
}
virtual cms::TemporaryQueue* createTemporaryQueue()
@@ -173,54 +173,55 @@
return session->createTemporaryTopic();
}
- virtual cms::Message* createMessage()
- throw ( cms::CMSException ) {
+ virtual cms::Message* createMessage()
+ throw ( cms::CMSException ) {
return session->createMessage();
}
- virtual cms::BytesMessage* createBytesMessage()
- throw ( cms::CMSException) {
+ virtual cms::BytesMessage* createBytesMessage()
+ throw ( cms::CMSException) {
return session->createBytesMessage();
}
-
+
virtual cms::BytesMessage* createBytesMessage(
const unsigned char* bytes,
- std::size_t bytesSize )
- throw ( cms::CMSException) {
- return session->createBytesMessage(bytes, bytesSize);
+ std::size_t bytesSize )
+ throw ( cms::CMSException) {
+ return session->createBytesMessage( bytes, bytesSize );
}
-
- virtual cms::TextMessage* createTextMessage()
+
+ virtual cms::TextMessage* createTextMessage()
throw ( cms::CMSException ) {
return session->createTextMessage();
}
- virtual cms::TextMessage* createTextMessage( const std::string& text )
+ virtual cms::TextMessage* createTextMessage( const std::string& text )
throw ( cms::CMSException ) {
- return session->createTextMessage(text);
+ return session->createTextMessage( text );
}
-
- virtual cms::MapMessage* createMapMessage()
+
+ virtual cms::MapMessage* createMapMessage()
throw ( cms::CMSException ) {
return session->createMapMessage();
}
-
+
virtual cms::Session::AcknowledgeMode getAcknowledgeMode() const {
return session->getAcknowledgeMode();
}
-
+
virtual bool isTransacted() const {
return session->isTransacted();
}
- virtual void unsubscribe( const std::string& name )
+ virtual void unsubscribe( const std::string& name )
throw ( cms::CMSException ) {
- session->unsubscribe(name);
+ session->unsubscribe( name );
}
-
+
private:
-
+
std::string getUniqueDestName( const cms::Destination* dest );
+
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ProducerCallback.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ProducerCallback.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ProducerCallback.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ProducerCallback.h Wed Nov 12 06:21:50 2008
@@ -30,23 +30,23 @@
*/
class AMQCPP_API ProducerCallback {
public:
-
+
virtual ~ProducerCallback(){}
-
+
/**
* Execute an action given a session and producer.
- *
- * @param session
+ *
+ * @param session
* the CMS <code>Session</code>
* @param producer
* the CMS <code>Producer</code>
* @throws cms::CMSException if thrown by CMS API methods
*/
- virtual void doInCms(cms::Session* session,
- cms::MessageProducer* producer) throw (cms::CMSException) = 0;
-
+ virtual void doInCms( cms::Session* session, cms::MessageProducer* producer )
+ throw ( cms::CMSException ) = 0;
+
};
}}
-#endif /*ACTIVEMQ_CMSUTIL_PRODUCERCALLBACK_H*/
+#endif /*ACTIVEMQ_CMSUTIL_PRODUCERCALLBACK_H*/
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.cpp?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.cpp Wed Nov 12 06:21:50 2008
@@ -27,11 +27,11 @@
ResourceLifecycleManager::~ResourceLifecycleManager() {
try {
-
+
// Destroy all the resources
destroy();
-
- } catch( cms::CMSException& e ) { /* Absorb*/}
+
+ } catch( cms::CMSException& e ) { /* Absorb*/ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -45,7 +45,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-void ResourceLifecycleManager::destroy() throw (cms::CMSException) {
+void ResourceLifecycleManager::destroy() throw ( cms::CMSException ) {
// Close all the connections.
for (std::size_t ix=0; ix<connections.size(); ++ix) {
@@ -92,4 +92,3 @@
// Empty all the vectors.
releaseAll();
}
-
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/ResourceLifecycleManager.h Wed Nov 12 06:21:50 2008
@@ -35,88 +35,89 @@
*/
class AMQCPP_API ResourceLifecycleManager {
private:
-
+
std::vector<cms::Connection*> connections;
std::vector<cms::Session*> sessions;
std::vector<cms::Destination*> destinations;
std::vector<cms::MessageProducer*> producers;
std::vector<cms::MessageConsumer*> consumers;
-
+
public:
-
+
ResourceLifecycleManager();
-
+
/**
* Destructor - calls <code>destroy</code>
*/
virtual ~ResourceLifecycleManager();
-
+
/**
* Adds a connection so that its life will be managed by
* this object.
- *
+ *
* @param connection
* the object to be managed
*/
- void addConnection(cms::Connection* connection) {
- connections.push_back(connection);
+ void addConnection( cms::Connection* connection ) {
+ connections.push_back( connection );
}
-
+
/**
* Adds a session so that its life will be managed by
* this object.
- *
+ *
* @param session
* the object to be managed
*/
- void addSession(cms::Session* session) {
- sessions.push_back(session);
+ void addSession( cms::Session* session ) {
+ sessions.push_back( session );
}
-
+
/**
* Adds a destination so that its life will be managed by
* this object.
- *
+ *
* @param dest
* the object to be managed
*/
- void addDestination(cms::Destination* dest) {
- destinations.push_back(dest);
+ void addDestination( cms::Destination* dest ) {
+ destinations.push_back( dest );
}
-
+
/**
* Adds a message producer so that its life will be managed by
* this object.
- *
+ *
* @param producer
* the object to be managed
*/
- void addMessageProducer(cms::MessageProducer* producer) {
- producers.push_back(producer);
+ void addMessageProducer( cms::MessageProducer* producer ) {
+ producers.push_back( producer );
}
-
+
/**
* Adds a message consumer so that its life will be managed by
* this object.
- *
+ *
* @param consumer
* the object to be managed
*/
- void addMessageConsumer(cms::MessageConsumer* consumer) {
- consumers.push_back(consumer);
+ void addMessageConsumer( cms::MessageConsumer* consumer ) {
+ consumers.push_back( consumer );
}
-
+
/**
* Closes and destroys the contained CMS resources.
* @throws cms::CMSException thrown if an error occurs.
*/
- void destroy() throw (cms::CMSException);
-
+ void destroy() throw ( cms::CMSException );
+
/**
- * Releases all of the contained resources so that this
- * object will no longer control their lifetimes.
+ * Releases all of the contained resources so that this
+ * object will no longer control their lifetimes.
*/
void releaseAll();
+
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionCallback.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionCallback.h?rev=713376&r1=713375&r2=713376&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionCallback.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/SessionCallback.h Wed Nov 12 06:21:50 2008
@@ -29,23 +29,22 @@
* CMS Session.
*/
class AMQCPP_API SessionCallback {
-
public:
-
+
virtual ~SessionCallback(){}
-
+
/**
* Execute any number of operations against the supplied CMS
* session.
- *
- * @param session
+ *
+ * @param session
* the CMS <code>Session</code>
* @throws cms::CMSException if thrown by CMS API methods
*/
- virtual void doInCms(cms::Session* session) throw (cms::CMSException) = 0;
-
+ virtual void doInCms( cms::Session* session ) throw ( cms::CMSException ) = 0;
+
};
}}
-#endif /*ACTIVEMQ_CMSUTIL_SESSIONCALLBACK_H*/
+#endif /*ACTIVEMQ_CMSUTIL_SESSIONCALLBACK_H*/