[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-commits
Subject:    svn commit: r739131 - /activemq/activemq-cpp/trunk/src/main/activemq/core/
From:       tabish () apache ! org
Date:       2009-01-30 1:36:27
Message-ID: 20090130013628.5DABE23888A0 () eris ! apache ! org
[Download RAW message or body]

Author: tabish
Date: Fri Jan 30 01:36:26 2009
New Revision: 739131

URL: http://svn.apache.org/viewvc?rev=739131&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-100

Additional refinements in the Core classes.

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSessionExecutor.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/DispatchData.h

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp \
                (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Fri Jan \
30 01:36:26 2009 @@ -89,21 +89,21 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::addDispatcher( commands::ConsumerInfo* consumer,
-    Dispatcher* dispatcher ) {
+void ActiveMQConnection::addDispatcher(
+    const commands::ConsumerId& consumer, Dispatcher* dispatcher ) {
 
     // Add the consumer to the map.
     synchronized( &dispatchers ) {
-        dispatchers.setValue( consumer->getConsumerId()->getValue(), dispatcher );
+        dispatchers.setValue( consumer, dispatcher );
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::removeDispatcher( const commands::ConsumerInfo* consumer ) \
{ +void ActiveMQConnection::removeDispatcher( const commands::ConsumerId& consumer ) \
{  
     // Remove the consumer from the map.
     synchronized( &dispatchers ) {
-        dispatchers.remove( consumer->getConsumerId()->getValue() );
+        dispatchers.remove( consumer );
     }
 }
 
@@ -180,8 +180,7 @@
 
         // Add this producer from the set of active consumer.
         synchronized( &activeProducers ) {
-            activeProducers.setValue(
-                producer->getProducerInfo()->getProducerId()->getValue(), producer \
); +            activeProducers.setValue( producer->getProducerId(), producer );
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -197,8 +196,7 @@
 
         // Remove this producer from the set of active consumer.
         synchronized( &activeProducers ) {
-            activeProducers.remove(
-                producer->getProducerInfo()->getProducerId()->getValue() );
+            activeProducers.remove( producer->getProducerId() );
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -460,7 +458,7 @@
             Dispatcher* dispatcher = NULL;
             synchronized( &dispatchers ) {
 
-                dispatcher = dispatchers.getValue( \
dispatch->getConsumerId()->getValue() ); +                dispatcher = \
dispatchers.getValue( *( dispatch->getConsumerId() ) );  
                 // If we have no registered dispatcher, the consumer was probably
                 // just closed.  Just delete the message.
@@ -469,7 +467,7 @@
                 } else {
 
                     // Dispatch the message.
-                    DispatchData data( dispatch->getConsumerId(), message );
+                    DispatchData data( *( dispatch->getConsumerId() ), message );
                     dispatcher->dispatch( data );
                 }
             }
@@ -491,7 +489,7 @@
             // Get the consumer info object for this consumer.
             ActiveMQProducer* producer = NULL;
             synchronized( &this->activeProducers ) {
-                producer = this->activeProducers.getValue( \
producerAck->getProducerId()->getValue() ); +                producer = \
this->activeProducers.getValue( *( producerAck->getProducerId() ) );  if( producer != \
NULL ){  producer->onProducerAck( *producerAck );
                 }
@@ -657,19 +655,19 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const commands::ConnectionInfo* ActiveMQConnection::getConnectionInfo() const
+const commands::ConnectionInfo& ActiveMQConnection::getConnectionInfo() const
     throw( exceptions::ActiveMQException ) {
 
     enforceConnected();
 
-    return &this->connectionInfo;
+    return this->connectionInfo;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const commands::ConnectionId* ActiveMQConnection::getConnectionId() const
+const commands::ConnectionId& ActiveMQConnection::getConnectionId() const
     throw( exceptions::ActiveMQException ) {
 
     enforceConnected();
 
-    return this->connectionInfo.getConnectionId();
+    return *( this->connectionInfo.getConnectionId() );
 }

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h \
                (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h Fri Jan \
30 01:36:26 2009 @@ -28,6 +28,7 @@
 #include <activemq/commands/BrokerInfo.h>
 #include <activemq/commands/ConnectionInfo.h>
 #include <activemq/commands/ConsumerInfo.h>
+#include <activemq/commands/ProducerInfo.h>
 #include <activemq/commands/LocalTransactionId.h>
 #include <activemq/commands/WireFormatInfo.h>
 #include <activemq/exceptions/ActiveMQException.h>
@@ -80,12 +81,12 @@
         /**
          * Map of message dispatchers indexed by consumer id.
          */
-        decaf::util::Map< long long, Dispatcher* > dispatchers;
+        decaf::util::Map< commands::ConsumerId, Dispatcher* > dispatchers;
 
         /**
          * Map of message dispatchers indexed by consumer id.
          */
-        decaf::util::Map< long long, ActiveMQProducer* > activeProducers;
+        decaf::util::Map< commands::ProducerId, ActiveMQProducer* > activeProducers;
 
         /**
          * Maintain the set of all active sessions.
@@ -151,13 +152,13 @@
          * @param consumer - The consumer for which to register a dispatcher.
          * @param dispatcher - The dispatcher to handle incoming messages for the \
                consumer.
          */
-        virtual void addDispatcher( commands::ConsumerInfo* consumer, Dispatcher* \
dispatcher ); +        virtual void addDispatcher( const commands::ConsumerId& \
consumer, Dispatcher* dispatcher );  
         /**
          * Removes the dispatcher for a consumer.
          * @param consumer - The consumer for which to remove the dispatcher.
          */
-        virtual void removeDispatcher( const commands::ConsumerInfo* consumer );
+        virtual void removeDispatcher( const commands::ConsumerId& consumer );
 
         /**
          * If supported sends a message pull request to the service provider asking
@@ -324,14 +325,14 @@
          * Gets the ConnectionInfo for this Object, if the Connection is not open
          * than this method throws an exception
          */
-        const commands::ConnectionInfo* getConnectionInfo() const
+        const commands::ConnectionInfo& getConnectionInfo() const
             throw( exceptions::ActiveMQException );
 
         /**
          * Gets the ConnectionId for this Object, if the Connection is not open
          * than this method throws an exception
          */
-        const commands::ConnectionId* getConnectionId() const
+        const commands::ConnectionId& getConnectionId() const
             throw( exceptions::ActiveMQException );
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.cpp?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.cpp \
                (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.cpp Fri Jan \
30 01:36:26 2009 @@ -61,6 +61,9 @@
     this->consumerInfo.reset( consumerInfo );
     this->listener = NULL;
     this->closed = false;
+
+    // Send our info to the Broker.
+    this->session->syncRequest( this->consumerInfo.get() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -83,7 +86,7 @@
 
             // Remove this Consumer from the Connections set of Dispatchers and then
             // remove it from the Broker.
-            this->session->disposeOf( this->getConsumerId() );
+            this->session->disposeOf( this->consumerInfo->getConsumerId() );
 
             this->closed = true;
 
@@ -543,7 +546,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConsumer::checkClosed() throw( exceptions::ActiveMQException ) {
+void ActiveMQConsumer::checkClosed() const throw( exceptions::ActiveMQException ) {
     if( this->isClosed() ) {
         throw ActiveMQException(
             __FILE__, __LINE__,

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h Fri Jan 30 \
01:36:26 2009 @@ -180,22 +180,20 @@
 
         /**
          * Get the Consumer information for this consumer
-         * @return Pointer to a Consumer Info Object
+         * @return Reference to a Consumer Info Object
          */
-        commands::ConsumerInfo* getConsumerInfo() {
-            return consumerInfo.get();
+        const commands::ConsumerInfo& getConsumerInfo() const {
+            this->checkClosed();
+            return *( this->consumerInfo );
         }
 
         /**
          * Get the Consumer Id for this consumer
-         * @return Pointer to a Consumer Id Object
+         * @return Reference to a Consumer Id Object
          */
-        commands::ConsumerId* getConsumerId() {
-            if( this->isClosed() ) {
-                return NULL;
-            }
-
-            return consumerInfo->getConsumerId();
+        const commands::ConsumerId& getConsumerId() const {
+            this->checkClosed();
+            return *( this->consumerInfo->getConsumerId() );
         }
 
         /**
@@ -256,7 +254,7 @@
             throw ( exceptions::ActiveMQException );
 
         // Checks for the closed state and throws if so.
-        void checkClosed() throw( exceptions::ActiveMQException );
+        void checkClosed() const throw( exceptions::ActiveMQException );
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp \
                (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.cpp Fri Jan \
30 01:36:26 2009 @@ -54,6 +54,8 @@
     this->disableMessageId = false;
     this->defaultPriority = 4;
     this->defaultTimeToLive = 0;
+
+    this->session->syncRequest( this->producerInfo.get() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -200,7 +202,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProducer::checkClosed() throw( exceptions::ActiveMQException ) {
+void ActiveMQProducer::checkClosed() const throw( exceptions::ActiveMQException ) {
     if( closed ) {
         throw ActiveMQException(
             __FILE__, __LINE__,

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.h?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQProducer.h Fri Jan 30 \
01:36:26 2009 @@ -251,22 +251,20 @@
 
         /**
          * Retries this object ProducerInfo pointer
-         * @return ProducerInfo pointer
+         * @return ProducerInfo Reference
          */
-        virtual commands::ProducerInfo* getProducerInfo(){
-            return this->producerInfo.get();
+        const commands::ProducerInfo& getProducerInfo() const {
+            this->checkClosed();
+            return *( this->producerInfo );
         }
 
         /**
          * Retries this object ProducerId or NULL if closed.
-         * @return ProducerId pointer
+         * @return ProducerId Reference
          */
-        virtual commands::ProducerId* getProducerId(){
-            if( this->isClosed() ) {
-                return NULL;
-            }
-
-            return this->producerInfo->getProducerId();
+        commands::ProducerId& getProducerId() const {
+            this->checkClosed();
+            return *( this->producerInfo->getProducerId() );
         }
 
         /**
@@ -278,7 +276,7 @@
    private:
 
        // Checks for the closed state and throws if so.
-       void checkClosed() throw( exceptions::ActiveMQException );
+       void checkClosed() const throw( exceptions::ActiveMQException );
 
    };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp Fri Jan 30 \
01:36:26 2009 @@ -263,19 +263,15 @@
         // Register this as a message dispatcher for the consumer since we
         // could start receiving messages from the broker right away once we
         // send the ConsumerInfo command.
-        this->connection->addDispatcher( consumerInfo.get(), this );
+        this->connection->addDispatcher( *( consumerInfo->getConsumerId() ), this );
 
         // Create the consumer instance.
         std::auto_ptr<ActiveMQConsumer> consumer(
             new ActiveMQConsumer( consumerInfo.release(), this, \
this->transaction.get() ) );  
-        // Send the message to the broker.
-        this->connection->syncRequest( consumer->getConsumerInfo() );
-
         // Add the consumer to the map.
         synchronized( &this->consumers ) {
-            this->consumers.setValue(
-                consumer->getConsumerInfo()->getConsumerId()->getValue(), \
consumer.get() ); +            this->consumers.setValue( consumer->getConsumerId(), \
consumer.get() );  }
 
         return consumer.release();
@@ -309,19 +305,15 @@
         // Register this as a message dispatcher for the consumer since we
         // could start receiving messages from the broker right away once we
         // send the ConsumerInfo command.
-        this->connection->addDispatcher( consumerInfo.get(), this );
+        this->connection->addDispatcher( *( consumerInfo->getConsumerId() ), this );
 
         // Create the consumer instance.
         std::auto_ptr<ActiveMQConsumer> consumer(
             new ActiveMQConsumer( consumerInfo.release(), this, \
this->transaction.get() ) );  
-        // Send the message to the broker.
-        this->connection->syncRequest( consumer->getConsumerInfo() );
-
         // Add the consumer to the map.
         synchronized( &this->consumers ) {
-            this->consumers.setValue(
-                consumer->getConsumerInfo()->getConsumerId()->getValue(), \
consumer.get() ); +            this->consumers.setValue( consumer->getConsumerId(), \
consumer.get() );  }
 
         return consumer.release();
@@ -341,8 +333,8 @@
         this->checkClosed();
 
         std::auto_ptr<commands::ProducerId> producerId( new commands::ProducerId() \
                );
-        producerId->setConnectionId( \
                this->getSessionInfo()->getSessionId()->getConnectionId() );
-        producerId->setSessionId( this->getSessionInfo()->getSessionId()->getValue() \
); +        producerId->setConnectionId( \
this->sessionInfo->getSessionId()->getConnectionId() ); +        \
producerId->setSessionId( this->sessionInfo->getSessionId()->getValue() );  \
producerId->setValue( this->connection->getNextProducerId() );  
         std::auto_ptr<commands::ProducerInfo> producerInfo( new \
commands::ProducerInfo() ); @@ -376,13 +368,9 @@
 
         producer->setSendTimeout( this->connection->getSendTimeout() );
 
-        // Send the message to the broker.
-        this->connection->syncRequest( producer->getProducerInfo() );
-
         synchronized( &this->producers ) {
             // Place the Producer into the Map.
-            this->producers.setValue(
-                producer->getProducerInfo()->getProducerId()->getValue(), \
producer.get() ); +            this->producers.setValue( producer->getProducerId(), \
producer.get() );  }
 
         // Add to the Connections list
@@ -593,12 +581,12 @@
         // flag.  Not adding a message ID will cause an NPE at the broker.
         commands::MessageId* id = new commands::MessageId();
         id->setProducerId(
-            producer->getProducerInfo()->getProducerId()->cloneDataStructure() );
+            producer->getProducerId().cloneDataStructure() );
         id->setProducerSequenceId( this->connection->getNextProducerSequenceId() );
 
         amqMessage->setMessageId( id );
         amqMessage->setProducerId(
-            producer->getProducerInfo()->getProducerId()->cloneDataStructure() );
+            producer->getProducerId().cloneDataStructure() );
 
         if( this->getAcknowledgeMode() == cms::Session::SESSION_TRANSACTED ) {
 
@@ -659,9 +647,9 @@
             new commands::RemoveSubscriptionInfo() );
 
         rsi->setConnectionId(
-            this->connection->getConnectionInfo()->getConnectionId()->cloneDataStructure() \
); +            this->connection->getConnectionId().cloneDataStructure() );
         rsi->setSubcriptionName( name );
-        rsi->setClientId( this->connection->getConnectionInfo()->getClientId() );
+        rsi->setClientId( this->connection->getConnectionInfo().getClientId() );
 
         // Send the message to the broker.
         this->connection->syncRequest( rsi.get() );
@@ -716,7 +704,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 bool ActiveMQSession::isStarted() const {
 
-    if( this->executor.get() != NULL ) {
+    if( this->executor.get() == NULL ) {
         return false;
     }
 
@@ -735,7 +723,7 @@
         std::auto_ptr<commands::ConsumerId> consumerId( new commands::ConsumerId() \
);  
         consumerId->setConnectionId(
-            this->connection->getConnectionId()->getValue() );
+            this->connection->getConnectionId().getValue() );
         consumerId->setSessionId( this->sessionInfo->getSessionId()->getValue() );
         consumerId->setValue( this->connection->getNextSessionId() );
 
@@ -867,7 +855,7 @@
     try {
 
         commands::DestinationInfo command;
-        command.setConnectionId( \
this->connection->getConnectionId()->cloneDataStructure() ); +        \
                command.setConnectionId( \
                this->connection->getConnectionId().cloneDataStructure() );
         command.setOperationType( ActiveMQConstants::DESTINATION_ADD_OPERATION );
         command.setDestination( tempDestination->cloneDataStructure() );
 
@@ -891,7 +879,7 @@
 
         commands::DestinationInfo command;
 
-        command.setConnectionId( \
this->connection->getConnectionId()->cloneDataStructure() ); +        \
                command.setConnectionId( \
                this->connection->getConnectionId().cloneDataStructure() );
         command.setOperationType( ActiveMQConstants::DESTINATION_REMOVE_OPERATION );
         command.setDestination( tempDestination->cloneDataStructure() );
 
@@ -908,7 +896,7 @@
     throw ( activemq::exceptions::ActiveMQException )
 {
     try {
-        return this->connection->getConnectionId()->getValue() + ":" +
+        return this->connection->getConnectionId().getValue() + ":" +
                Long::toString( this->connection->getNextTempDestinationId() );
     }
     AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )
@@ -923,7 +911,7 @@
     try{
         std::auto_ptr<commands::LocalTransactionId> id( new \
commands::LocalTransactionId() );  
-        id->setConnectionId( \
this->connection->getConnectionId()->cloneDataStructure() ); +        \
id->setConnectionId( this->connection->getConnectionId().cloneDataStructure() );  \
id->setValue( this->connection->getNextTransactionId() );  
         return id.release();
@@ -960,7 +948,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::checkClosed() throw( exceptions::ActiveMQException ) {
+void ActiveMQSession::checkClosed() const throw( exceptions::ActiveMQException ) {
     if( closed ) {
         throw ActiveMQException(
             __FILE__, __LINE__,
@@ -978,7 +966,7 @@
 
         synchronized( &this->consumers ) {
 
-            if( this->consumers.containsKey( id->getValue() ) ) {
+            if( this->consumers.containsKey( *id ) ) {
 
                 // If the executor thread is currently running, stop it.
                 bool wasStarted = isStarted();
@@ -986,11 +974,11 @@
                     stop();
                 }
 
-                ActiveMQConsumer* consumer = this->consumers.getValue( \
                id->getValue() );
-                this->connection->removeDispatcher( consumer->getConsumerInfo() );
+                ActiveMQConsumer* consumer = this->consumers.getValue( *id );
+                this->connection->removeDispatcher( consumer->getConsumerId() );
                 this->connection->disposeOf( id );
 
-                this->consumers.remove( id->getValue() );
+                this->consumers.remove( *id );
 
                 //TODO
 //              // Remove this consumer from the Transaction if we are transacted
@@ -1032,13 +1020,13 @@
 
         synchronized( &this->producers ) {
 
-            if( this->producers.containsKey( id->getValue() ) ) {
+            if( this->producers.containsKey( *id ) ) {
 
-                ActiveMQProducer* producer = this->producers.getValue( \
id->getValue() ); +                ActiveMQProducer* producer = \
this->producers.getValue( *id );  this->connection->removeProducer( producer );
                 this->connection->disposeOf( id );
 
-                this->producers.remove( id->getValue() );
+                this->producers.remove( *id );
             }
         }
     }

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h Fri Jan 30 \
01:36:26 2009 @@ -77,12 +77,12 @@
         /**
          * Map of consumers.
          */
-        decaf::util::Map<long long, ActiveMQConsumer*> consumers;
+        decaf::util::Map< commands::ConsumerId, ActiveMQConsumer*> consumers;
 
         /**
          * Map of producers.
          */
-        decaf::util::Map<long long, ActiveMQProducer*> producers;
+        decaf::util::Map< commands::ProducerId, ActiveMQProducer*> producers;
 
         /**
          * Sends incoming messages to the registered consumers.
@@ -103,7 +103,7 @@
 
         virtual ~ActiveMQSession();
 
-        decaf::util::Map<long long, ActiveMQConsumer*>& getConsumers() {
+        decaf::util::Map< commands::ConsumerId, ActiveMQConsumer*>& getConsumers() {
             return consumers;
         }
 
@@ -375,11 +375,22 @@
 
         /**
          * Gets the Session Information object for this session, if the
-         * session is closed than this returns null
-         * @return SessionInfo Pointer
+         * session is closed than this method throws an exception.
+         * @return SessionInfo Reference
          */
-        commands::SessionInfo* getSessionInfo() {
-            return this->sessionInfo.get();
+        const commands::SessionInfo& getSessionInfo() const {
+            this->checkClosed();
+            return *( this->sessionInfo );
+        }
+
+        /**
+         * Gets the Session Id object for this session, if the session
+         * is closed than this method throws an exception.
+         * @return SessionId Reference
+         */
+        const commands::SessionId& getSessionId() const {
+            this->checkClosed();
+            return *( this->sessionInfo->getSessionId() );
         }
 
         /**
@@ -428,7 +439,7 @@
    private:
 
        // Checks for the closed state and throws if so.
-       void checkClosed() throw( exceptions::ActiveMQException );
+       void checkClosed() const throw( exceptions::ActiveMQException );
 
        // Performs the work of creating and configuring a valid Consumer Info, this
        // can be used both by the normal createConsumer call and by a \
createDurableConsumer

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSessionExecutor.cpp
                
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSessionExecutor.cpp?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSessionExecutor.cpp \
                (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSessionExecutor.cpp \
Fri Jan 30 01:36:26 2009 @@ -94,17 +94,15 @@
 {
     vector<ActiveMQMessage*> retVal;
 
-    const commands::ConsumerInfo* consumerInfo = consumer->getConsumerInfo();
-
     synchronized( &mutex ) {
 
         list<DispatchData>::iterator iter = messageQueue.begin();
         while( iter != messageQueue.end() ) {
             list<DispatchData>::iterator currentIter = iter;
             DispatchData& dispatchData = *iter++;
-            if( consumerInfo->getConsumerId() == dispatchData.getConsumerId() ) {
+            if( consumer->getConsumerId() == dispatchData.getConsumerId() ) {
                 retVal.push_back( dispatchData.getMessage() );
-                messageQueue.erase(currentIter);
+                messageQueue.erase( currentIter );
             }
         }
     }
@@ -169,10 +167,10 @@
     try {
 
         ActiveMQConsumer* consumer = NULL;
-        Map<long long, ActiveMQConsumer*>& consumers = session->getConsumers();
+        Map< commands::ConsumerId, ActiveMQConsumer*>& consumers = \
session->getConsumers();  
         synchronized( &consumers ) {
-            consumer = consumers.getValue( data.getConsumerId()->getValue() );
+            consumer = consumers.getValue( data.getConsumerId() );
         }
 
         // If the consumer is not available, just delete the message.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.cpp
                
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.cpp?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.cpp \
                (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.cpp \
Fri Jan 30 01:36:26 2009 @@ -208,7 +208,7 @@
         this->transactionInfo.reset( new commands::TransactionInfo() );
 
         this->transactionInfo->setConnectionId(
-            this->connection->getConnectionId()->cloneDataStructure() );
+            this->connection->getConnectionId().cloneDataStructure() );
         this->transactionInfo->setTransactionId( createLocalTransactionId() );
         this->transactionInfo->setType( ActiveMQConstants::TRANSACTION_STATE_BEGIN \
);  
@@ -227,7 +227,7 @@
 
         std::auto_ptr<commands::LocalTransactionId> id( new \
commands::LocalTransactionId() );  
-        id->setConnectionId( \
this->connection->getConnectionId()->cloneDataStructure() ); +        \
id->setConnectionId( this->connection->getConnectionId().cloneDataStructure() );  \
id->setValue( this->connection->getNextTransactionId() );  
         return id.release();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/DispatchData.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/DispatchData.h?rev=739131&r1=739130&r2=739131&view=diff
 ==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/DispatchData.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/DispatchData.h Fri Jan 30 \
01:36:26 2009 @@ -34,17 +34,16 @@
     class AMQCPP_API DispatchData {
     private:
 
-        commands::ConsumerId* consumerId;
+        commands::ConsumerId consumerId;
         ActiveMQMessage* message;
 
     public:
 
         DispatchData(){
-            consumerId = NULL;
             message = NULL;
         }
 
-        DispatchData( commands::ConsumerId* consumer, ActiveMQMessage* message ) {
+        DispatchData( const commands::ConsumerId& consumer, ActiveMQMessage* message \
) {  this->consumerId = consumer;
             this->message = message;
         }
@@ -59,7 +58,7 @@
             return *this;
         }
 
-        commands::ConsumerId* getConsumerId() {
+        const commands::ConsumerId& getConsumerId() {
             return consumerId;
         }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic