activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1461326 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/commands/ main/activemq/core/ main/activemq/core/kernels/ test/activemq/core/
Date Tue, 26 Mar 2013 21:34:01 GMT
Author: tabish
Date: Tue Mar 26 21:34:01 2013
New Revision: 1461326

URL: http://svn.apache.org/r1461326
Log:
Adding getHashCode to some of the objects.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.cpp
Tue Mar 26 21:34:01 2013
@@ -26,6 +26,7 @@
 
 #include <decaf/util/StringTokenizer.h>
 #include <decaf/util/StlSet.h>
+#include <decaf/util/HashCode.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
 #include <decaf/internal/util/StringUtils.h>
 
@@ -71,14 +72,14 @@ namespace {
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQDestination::ActiveMQDestination() :
     BaseDataStructure(), exclusive(false), ordered(false), advisory(false), compositeDestinations(),
-    orderedTarget(DEFAULT_ORDERED_TARGET), physicalName(), options() {
+    orderedTarget(DEFAULT_ORDERED_TARGET), physicalName(), options(), hashCode() {
 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQDestination::ActiveMQDestination(const std::string& physicalName) :
     BaseDataStructure(), exclusive(false), ordered(false), advisory(false), compositeDestinations(),
-    orderedTarget(DEFAULT_ORDERED_TARGET), physicalName(), options() {
+    orderedTarget(DEFAULT_ORDERED_TARGET), physicalName(), options(), hashCode() {
 
     this->setPhysicalName(physicalName);
 }
@@ -101,6 +102,8 @@ void ActiveMQDestination::setPhysicalNam
 
     this->advisory = physicalName.find_first_of(AdvisorySupport::ADVISORY_TOPIC_PREFIX)
== 0;
     this->compositeDestinations.clear();
+
+    this->hashCode = HashCode<std::string>()(this->physicalName);
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQDestination.h
Tue Mar 26 21:34:01 2013
@@ -35,8 +35,8 @@
 #include <string>
 #include <map>
 
-namespace activemq{
-namespace commands{
+namespace activemq {
+namespace commands {
 
     using decaf::lang::Pointer;
 
@@ -72,6 +72,7 @@ namespace commands{
 
         std::string physicalName;
         util::ActiveMQProperties options;
+        int hashCode;
 
     public:
 
@@ -104,6 +105,10 @@ namespace commands{
 
         virtual std::string toString() const;
 
+        int getHashCode() const {
+            return this->hashCode;
+        }
+
     public:
 
         /**
@@ -134,27 +139,6 @@ namespace commands{
             this->advisory = advisory;
         }
 
-//        /**
-//         * @return true if this is a destination for Consumer advisories
-//         */
-//        virtual bool isConsumerAdvisory() const {
-//            return isAdvisory() && physicalName.find(CONSUMER_ADVISORY_PREFIX)
== 0;
-//        }
-//
-//        /**
-//         * @return true if this is a destination for Producer advisories
-//         */
-//        virtual bool isProducerAdvisory() const {
-//            return isAdvisory() && physicalName.find(PRODUCER_ADVISORY_PREFIX)
== 0;
-//        }
-//
-//        /**
-//         * @return true if this is a destination for Connection advisories
-//         */
-//        virtual bool isConnectionAdvisory() const {
-//            return isAdvisory() && physicalName.find(CONNECTION_ADVISORY_PREFIX)
== 0;
-//        }
-
         /**
          * @return Returns the exclusive.
          */

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.cpp?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.cpp
Tue Mar 26 21:34:01 2013
@@ -39,6 +39,10 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
+const int ActiveMQMessageAudit::DEFAULT_WINDOW_SIZE = 2048;
+const int ActiveMQMessageAudit::MAXIMUM_PRODUCER_COUNT = 64;
+
+////////////////////////////////////////////////////////////////////////////////
 namespace activemq {
 namespace core {
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.h?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageAudit.h
Tue Mar 26 21:34:01 2013
@@ -36,6 +36,11 @@ namespace core {
 
     public:
 
+        static const int DEFAULT_WINDOW_SIZE;
+        static const int MAXIMUM_PRODUCER_COUNT;
+
+    public:
+
         /**
          * Default Constructor windowSize = 2048, maximumNumberOfProducersToTrack = 64
          */

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp Tue
Mar 26 21:34:01 2013
@@ -45,8 +45,9 @@ namespace core {
         int deliveredCounter;
         Pointer<ConsumerInfo> info;
         AtomicBoolean closed;
+        int hashCode;
 
-        AdvisoryConsumerConfig() : deliveredCounter(0), info(), closed(false) {
+        AdvisoryConsumerConfig() : deliveredCounter(0), info(), closed(false), hashCode()
{
         }
     };
 
@@ -69,6 +70,8 @@ AdvisoryConsumer::AdvisoryConsumer(Activ
     this->config->info->setNoLocal(true);
     this->config->info->setDispatchAsync(true);
 
+    this->config->hashCode = consumerId->getHashCode();
+
     try {
         this->connection->addDispatcher(this->config->info->getConsumerId(),
this);
         this->connection->syncRequest(this->config->info);
@@ -149,3 +152,8 @@ void AdvisoryConsumer::processDestinatio
         this->connection->removeTempDestination(tempDest);
     }
 }
+
+////////////////////////////////////////////////////////////////////////////////
+int AdvisoryConsumer::getHashCode() const {
+   return this->config->hashCode;
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.h?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.h Tue
Mar 26 21:34:01 2013
@@ -55,6 +55,8 @@ namespace core {
 
         virtual void dispatch(const Pointer<MessageDispatch>& message);
 
+        virtual int getHashCode() const;
+
     private:
 
         void processDestinationInfo(Pointer<commands::DestinationInfo> destination);

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Dispatcher.h Tue Mar 26
21:34:01 2013
@@ -44,6 +44,13 @@ namespace core {
          */
         virtual void dispatch(const Pointer<commands::MessageDispatch>& message)
= 0;
 
+        /**
+         * HashCode method allowing Dispatcher instances to be used in HashMap etc.
+         *
+         * @returns hash value for this Dispatcher.
+         */
+        virtual int getHashCode() const = 0;
+
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
Tue Mar 26 21:34:01 2013
@@ -94,6 +94,7 @@ namespace kernels {
         Pointer<RedeliveryPolicy> redeliveryPolicy;
         Pointer<Exception> failureError;
         Pointer<Scheduler> scheduler;
+        int hashCode;
 
         ActiveMQConsumerKernelConfig() : listener(NULL),
                                          messageAvailableListener(NULL),
@@ -113,7 +114,8 @@ namespace kernels {
                                          redeliveryDelay(0),
                                          redeliveryPolicy(),
                                          failureError(),
-                                         scheduler() {
+                                         scheduler(),
+                                         hashCode() {
         }
     };
 
@@ -362,6 +364,7 @@ ActiveMQConsumerKernel::ActiveMQConsumer
     // Initialize Consumer Data
     this->session = session;
     this->consumerInfo = consumerInfo;
+    this->internal->hashCode = id->getHashCode();
     this->internal->lastDeliveredSequenceId = -1;
     this->internal->synchronizationRegistered = false;
     this->internal->additionalWindowSize = 0;
@@ -1419,3 +1422,8 @@ void ActiveMQConsumerKernel::setMessageA
 cms::MessageAvailableListener* ActiveMQConsumerKernel::getMessageAvailableListener() const
{
     return this->internal->messageAvailableListener;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQConsumerKernel::getHashCode() const {
+    return this->internal->hashCode;
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.h?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.h
Tue Mar 26 21:34:01 2013
@@ -119,6 +119,8 @@ namespace kernels {
 
         virtual void dispatch( const Pointer<MessageDispatch>& message );
 
+        virtual int getHashCode() const;
+
     public:  // ActiveMQConsumerKernel Methods
 
         /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
Tue Mar 26 21:34:01 2013
@@ -99,12 +99,13 @@ namespace kernels{
         Pointer<CloseSynhcronization> closeSync;
         Mutex sendMutex;
         cms::MessageTransformer* transformer;
+        int hashCode;
 
     public:
 
         SessionConfig() : synchronizationRegistered(false),
                           producerLock(), producers(), consumerLock(), consumers(),
-                          scheduler(), closeSync(), sendMutex(), transformer(NULL) {}
+                          scheduler(), closeSync(), sendMutex(), transformer(NULL), hashCode()
{}
         ~SessionConfig() {}
     };
 
@@ -212,6 +213,8 @@ ActiveMQSessionKernel::ActiveMQSessionKe
     this->sessionInfo->setAckMode(ackMode);
     this->sessionInfo->setSessionId(id);
 
+    this->config->hashCode = id->getHashCode();
+
     try {
         this->connection->oneway(this->sessionInfo);
     } catch (...) {
@@ -1447,3 +1450,8 @@ Pointer<commands::ProducerId> ActiveMQSe
 
     return producerId;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQSessionKernel::getHashCode() const {
+    return this->config->hashCode;
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h
Tue Mar 26 21:34:01 2013
@@ -542,6 +542,8 @@ namespace kernels {
          */
         bool iterateConsumers();
 
+        virtual int getHashCode() const;
+
    private:
 
        /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp?rev=1461326&r1=1461325&r2=1461326&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionTest.cpp
Tue Mar 26 21:34:01 2013
@@ -95,6 +95,10 @@ namespace core{
         {
             messages.push_back( data->getMessage() );
         }
+
+        virtual int getHashCode() const {
+            return 1;
+        }
     };
 }}
 



Mime
View raw message