activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r508569 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core: ActiveMQConnection.cpp ActiveMQConnection.h
Date Fri, 16 Feb 2007 20:40:47 GMT
Author: tabish
Date: Fri Feb 16 12:40:46 2007
New Revision: 508569

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?view=diff&rev=508569&r1=508568&r2=508569
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
Fri Feb 16 12:40:46 2007
@@ -55,7 +55,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::Session* ActiveMQConnection::createSession() 
+cms::Session* ActiveMQConnection::createSession()
     throw ( cms::CMSException )
 {
     try
@@ -68,28 +68,28 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Session* ActiveMQConnection::createSession(
-   cms::Session::AcknowledgeMode ackMode ) 
+   cms::Session::AcknowledgeMode ackMode )
       throw ( cms::CMSException )
 {
     try
     {
         // Create the session instance.
         ActiveMQSession* session = new ActiveMQSession(
-            connectionData->getConnector()->createSession( ackMode ), 
+            connectionData->getConnector()->createSession( ackMode ),
             connectionData->getProperties(),
             this );
-        
+
         // Add the session to the set of active sessions.
         synchronized( &activeSessions ) {
             activeSessions.add( session );
-        } 
-            
+        }
+
         return session;
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
-   
+
 ////////////////////////////////////////////////////////////////////////////////
 std::string ActiveMQConnection::getClientId() const
 {
@@ -105,13 +105,13 @@
         {
             return;
         }
-        
+
         // Get the complete list of active sessions.
         std::vector<cms::Session*> allSessions;
         synchronized( &activeSessions ) {
             allSessions = activeSessions.toArray();
         }
-        
+
         // Close all of the resources.
         for( unsigned int ix=0; ix<allSessions.size(); ++ix ){
             cms::Session* session = allSessions[ix];
@@ -122,7 +122,7 @@
             }
         }
 
-        // Once current deliveries are done this stops the delivery 
+        // Once current deliveries are done this stops the delivery
         // of any new messages.
         started = false;
         closed = true;
@@ -154,9 +154,9 @@
     // new messages.
     started = false;
 }
-   
+
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::addMessageListener( const unsigned int consumerId,
+void ActiveMQConnection::addMessageListener( long long consumerId,
                                              ActiveMQMessageListener* listener )
 {
     // Place in Map
@@ -165,9 +165,9 @@
         consumers.setValue( consumerId, listener );
     }
 }
-  
+
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::removeMessageListener( const unsigned int consumerId )
+void ActiveMQConnection::removeMessageListener( long long consumerId )
 {
     // Remove from Map
     synchronized( &consumers )
@@ -200,27 +200,27 @@
             // Indicate to Broker that we received the message, but it
             // was not consumed.
             connectionData->getConnector()->acknowledge(
-                consumer->getSessionInfo(), 
-                (Message*)message, 
+                consumer->getSessionInfo(),
+                (Message*)message,
                 Connector::DeliveredAck );
-                
+
             // Delete the message here
             delete message;
-            
+
             return;
         }
-        
+
         // Started, so lock map and dispatch the message.
         synchronized( &consumers )
         {
             if( consumers.containsKey(consumer->getConsumerId()) )
             {
-                ActiveMQMessageListener* listener = 
+                ActiveMQMessageListener* listener =
                     consumers.getValue(consumer->getConsumerId());
-                    
+
                 listener->onActiveMQMessage( message );
             }
-        }        
+        }
     }
     catch( exceptions::ActiveMQException& ex )
     {
@@ -229,25 +229,25 @@
     }
     catch( ... )
     {
-        exceptions::ActiveMQException ex( 
-           __FILE__, __LINE__, 
+        exceptions::ActiveMQException ex(
+           __FILE__, __LINE__,
            "IOTransport::run - caught unknown exception" );
-        fire( ex );            
+        fire( ex );
     }
 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQConnection::onException( const CMSException& ex ){
-    
+
     if( exceptionListener != NULL ){
         exceptionListener->onException( ex );
     }
-}              
+}
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConnection::removeSession( ActiveMQSession* session ) 
-    throw ( cms::CMSException ) 
+void ActiveMQConnection::removeSession( ActiveMQSession* session )
+    throw ( cms::CMSException )
 {
     try
     {
@@ -255,15 +255,15 @@
         synchronized( &activeSessions ) {
             activeSessions.remove( session );
         }
-        
+
         // Destroy this sessions resources
         getConnectionData()->
             getConnector()->destroyResource( session->getSessionInfo() );
-            
+
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
-                          
+
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h?view=diff&rev=508569&r1=508568&r2=508569
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h Fri
Feb 16 12:40:46 2007
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #ifndef _ACTIVEMQ_CORE_ACTIVEMQCONNECTION_H_
 #define _ACTIVEMQ_CORE_ACTIVEMQCONNECTION_H_
 
@@ -33,31 +33,31 @@
 namespace activemq{
 namespace core{
 
-    class cms::Session;  
-    class ActiveMQSession; 
+    class cms::Session;
+    class ActiveMQSession;
     class ActiveMQConsumer;
 
     /**
      * Concrete connection used for all connectors to the
      * ActiveMQ broker.
      */
-    class ActiveMQConnection : 
+    class ActiveMQConnection :
         public cms::Connection,
         public connector::ConsumerMessageListener,
         public cms::ExceptionListener
     {
     private:
-   
+
         /**
          * the registered exception listener
          */
         cms::ExceptionListener* exceptionListener;
-      
+
         /**
          * All the data that is used to connect this Connection
          */
         ActiveMQConnectionData* connectionData;
-      
+
         /**
          * Indicates if this Connection is started
          */
@@ -68,94 +68,94 @@
          * usable after this becomes true
          */
         bool closed;
-      
+
         /**
          * Map of Consumer Ids to ActiveMQMessageListeners
          */
-        util::Map< unsigned int, ActiveMQMessageListener* > consumers;
-        
+        util::Map< long long, ActiveMQMessageListener* > consumers;
+
         /**
          * Maintain the set of all active sessions.
          */
         util::Set<cms::Session*> activeSessions;
-   
+
     public:
 
         /**
          * Constructor
          * @param Pointer to an ActiveMQConnectionData object, owned here
-         */       
+         */
         ActiveMQConnection( ActiveMQConnectionData* connectionData );
 
         virtual ~ActiveMQConnection();
-   
+
         /**
          * Removes the session resources for the given session
          * instance.
          * @param session The session to be unregistered from this connection.
          */
         virtual void removeSession( ActiveMQSession* session ) throw ( cms::CMSException
);
-        
+
     public:   // Connection Interface Methods
-   
+
         /**
          * Creates a new Session to work for this Connection
          * @throws CMSException
          */
         virtual cms::Session* createSession() throw ( cms::CMSException );
-      
+
         /**
          * Creates a new Session to work for this Connection using the
          * specified acknowledgment mode
          * @param ackMode the Acknowledgement Mode to use.
          * @throws CMSException
          */
-        virtual cms::Session* createSession( cms::Session::AcknowledgeMode ackMode ) 
+        virtual cms::Session* createSession( cms::Session::AcknowledgeMode ackMode )
             throw ( cms::CMSException );
-         
+
         /**
          * Get the Client Id for this session
          * @return string version of Client Id
          */
         virtual std::string getClientId() const;
-      
+
         /**
          * Retrieves the Connection Data object for this object.
          * @return pointer to a connection data object.
          */
         virtual ActiveMQConnectionData* getConnectionData(){
             return connectionData;
-        } 
-         
+        }
+
         /**
          * Gets the registered Exception Listener for this connection
          * @return pointer to an exception listnener or NULL
          */
         virtual cms::ExceptionListener* getExceptionListener() const{
             return exceptionListener; };
-      
+
         /**
          * Sets the registed Exception Listener for this connection
          * @param listener pointer to and <code>ExceptionListener</code>
          */
         virtual void setExceptionListener( cms::ExceptionListener* listener ){
-            exceptionListener = listener; 
+            exceptionListener = listener;
         };
-         
+
         /**
-         * Closes this connection as well as any Sessions 
+         * Closes this connection as well as any Sessions
          * created from it (and those Sessions' consumers and
          * producers).
          * @throws CMSException
          */
         virtual void close() throw ( cms::CMSException );
-      
+
         /**
          * Starts or (restarts) a connections delivery of incoming messages
          * @throws CMSException
          */
         virtual void start() throw ( cms::CMSException );
-      
+
         /**
          * Stop the flow of incoming messages
          * @throws CMSException
@@ -163,7 +163,7 @@
         virtual void stop() throw ( cms::CMSException );
 
     public:   // ActiveMQConnection Methods
-   
+
         /**
          * Adds the ActiveMQMessageListener to the Mapping of Consumer Id's
          * to listeners, all message to that id will be routed to the given
@@ -171,17 +171,17 @@
          * @param consumerId Consumer Id String
          * @param listener ActiveMQMessageListener Pointer
          */
-        virtual void addMessageListener( const unsigned int consumerId,
-                                         ActiveMQMessageListener* listener ); 
-      
+        virtual void addMessageListener( long long consumerId,
+                                         ActiveMQMessageListener* listener );
+
         /**
          * Remove the Listener for the specified Consumer Id
          * @param consumerId Consumer Id string
          */
-        virtual void removeMessageListener( const unsigned int consumerId );
+        virtual void removeMessageListener( long long consumerId );
 
     public:     // ExceptionListener interface methods
-    
+
         /**
          * Called when an exception occurs.  Once notified of an exception
          * the caller should no longer use the resource that generated the
@@ -189,9 +189,9 @@
          * @param Exception Object that occurred.
          */
         virtual void onException( const cms::CMSException& ex );
-        
+
     public:     // ConsumerMessageListener interface methods
-    
+
         /**
          * Called to dispatch a message to a particular consumer.
          * @param consumer the target consumer of the dispatch.
@@ -199,9 +199,9 @@
          */
         virtual void onConsumerMessage( connector::ConsumerInfo* consumer,
                                         core::ActiveMQMessage* message );
-                                                                                
+
     private:
-   
+
         /**
          * Notify the excpetion listener
          * @param ex the exception to fire
@@ -216,8 +216,8 @@
                 }
                 catch(...){}
             }
-        }        
-   
+        }
+
     };
 
 }}



Mime
View raw message