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 2009/04/14 22:07:06 UTC

svn commit: r764942 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq: commands/ wireformat/openwire/

Author: tabish
Date: Tue Apr 14 20:07:05 2009
New Revision: 764942

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

Adds max inactivity duration configuration to the wireformat URI for Openwire.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.cpp?rev=764942&r1=764941&r2=764942&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.cpp Tue Apr 14 20:07:05 2009
@@ -109,8 +109,11 @@
     stream << " Value of stackTraceEnabled = " << isStackTraceEnabled() << std::endl;
     stream << " Value of tcpNoDelayEnabled = " << isTcpNoDelayEnabled() << std::endl;
     stream << " Value of cacheEnabled = " << isCacheEnabled() << std::endl;
+    stream << " Value of cacheSize = " << getCacheSize() << std::endl;
     stream << " Value of tightEncodingEnabled = " << isTightEncodingEnabled() << std::endl;
     stream << " Value of sizePrefixDisabled = " << isSizePrefixDisabled() << std::endl;
+    stream << " Value of maxInactivityDuration = " << getMaxInactivityDuration() << std::endl;
+    stream << " Value of maxInactivityDuration = " << getMaxInactivityDurationInitalDelay() << std::endl;
 
     stream << BaseCommand::toString();
     stream << "End Class = WireFormatInfo" << std::endl;
@@ -149,6 +152,9 @@
     if( isCacheEnabled() != wireFormatInfo->isCacheEnabled() ) {
         return false;
     }
+    if( getCacheSize() != wireFormatInfo->getCacheSize() ) {
+        return false;
+    }
     if( isTightEncodingEnabled() != wireFormatInfo->isTightEncodingEnabled() ) {
         return false;
     }
@@ -158,6 +164,12 @@
     if( !BaseCommand::equals( value ) ) {
         return false;
     }
+    if( getMaxInactivityDuration() != wireFormatInfo->getMaxInactivityDuration() ) {
+        return false;
+    }
+    if( getMaxInactivityDurationInitalDelay() != wireFormatInfo->getMaxInactivityDurationInitalDelay() ) {
+        return false;
+    }
 
     return true;
 }
@@ -372,3 +384,23 @@
     AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_NOTHROW()
 }
+
+////////////////////////////////////////////////////////////////////////////////
+int WireFormatInfo::getCacheSize() const {
+    try {
+        return properties.getInt( "CacheSize" );
+    }
+    AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+    AMQ_CATCHALL_NOTHROW()
+
+    return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void WireFormatInfo::setCacheSize( int value ) {
+    try {
+        properties.setInt( "CacheSize", value );
+    }
+    AMQ_CATCH_NOTHROW( exceptions::ActiveMQException )
+    AMQ_CATCHALL_NOTHROW()
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h?rev=764942&r1=764941&r2=764942&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h Tue Apr 14 20:07:05 2009
@@ -186,6 +186,18 @@
         void setCacheEnabled( bool cacheEnabled );
 
         /**
+         * Gets the Cache Size setting.
+         * @return currently set cache size.
+         */
+        int getCacheSize() const;
+
+        /**
+         * Sets the Cache Size setting.
+         * @param value - value to set to the cache size.
+         */
+        void setCacheSize( int value );
+
+        /**
          * Checks if the tightEncodingEnabled flag is on
          * @return true if the flag is on.
          */

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp?rev=764942&r1=764941&r2=764942&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp Tue Apr 14 20:07:05 2009
@@ -65,11 +65,14 @@
     this->id = UUID::randomUUID().toString();
     // Set defaults for initial WireFormat negotiation
     this->version = 0;
-    this->stackTraceEnabled = false;
-    this->cacheEnabled = false;
-    this->tcpNoDelayEnabled = false;
+    this->stackTraceEnabled = true;
+    this->cacheEnabled = true;
+    this->cacheSize = 1024;
+    this->tcpNoDelayEnabled = true;
     this->tightEncodingEnabled = false;
     this->sizePrefixDisabled = false;
+    this->maxInactivityDuration = 30000;
+    this->maxInactivityDurationInitialDelay = 10000;
 
     // Set to Default as lowest common denominator, then we will try
     // and move up to the preferred when the wireformat is negotiated.
@@ -535,4 +538,9 @@
                                  preferedWireFormatInfo->isTightEncodingEnabled();
     this->sizePrefixDisabled = info.isSizePrefixDisabled() &&
                                preferedWireFormatInfo->isSizePrefixDisabled();
+    this->cacheSize = min( info.getCacheSize(), preferedWireFormatInfo->getCacheSize() );
+    this->maxInactivityDuration = min( info.getMaxInactivityDuration(),
+                                       preferedWireFormatInfo->getMaxInactivityDuration() );
+    this->maxInactivityDurationInitialDelay = min( info.getMaxInactivityDurationInitalDelay(),
+                                                   preferedWireFormatInfo->getMaxInactivityDurationInitalDelay() );
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h?rev=764942&r1=764941&r2=764942&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h Tue Apr 14 20:07:05 2009
@@ -67,8 +67,11 @@
         bool stackTraceEnabled;
         bool tcpNoDelayEnabled;
         bool cacheEnabled;
+        int cacheSize;
         bool tightEncodingEnabled;
         bool sizePrefixDisabled;
+        long long maxInactivityDuration;
+        long long maxInactivityDurationInitialDelay;
 
     public:
 
@@ -274,6 +277,22 @@
         }
 
         /**
+         * Returns the currently set Cache size.
+         * @return the current value of the broker's cache size.
+         */
+        int getCacheSize() const {
+            return cacheSize;
+        }
+
+        /**
+         * Sets the current Cache size.
+         * @param value - the value to send as the broker's cache size.
+         */
+        void setCacheSize( int value ) {
+            this->cacheSize = value;
+        }
+
+        /**
          * Checks if the tightEncodingEnabled flag is on
          * @return true if the flag is on.
          */
@@ -305,6 +324,38 @@
             this->sizePrefixDisabled = sizePrefixDisabled;
         }
 
+        /**
+         * Gets the MaxInactivityDuration setting.
+         * @return maximum inactivity duration value in milliseconds.
+         */
+        long long getMaxInactivityDuration() const {
+            return this->maxInactivityDuration;
+        }
+
+        /**
+         * Sets the MaxInactivityDuration setting.
+         * @param value - the Max inactivity duration value in milliseconds.
+         */
+        void setMaxInactivityDuration( long long value ) {
+            this->maxInactivityDuration = value;
+        }
+
+        /**
+         * Gets the MaxInactivityDurationInitialDelay setting.
+         * @return maximum inactivity duration initial delay value in milliseconds.
+         */
+        long long getMaxInactivityDurationInitialDelay() const {
+            return this->maxInactivityDurationInitialDelay;
+        }
+
+        /**
+         * Sets the MaxInactivityDurationInitialDelay setting.
+         * @param value - the Max inactivity Initial Delay duration value in milliseconds.
+         */
+        void setMaxInactivityDurationInitialDelay( long long value ) {
+            this->maxInactivityDurationInitialDelay = value;
+        }
+
     protected:
 
         /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp?rev=764942&r1=764941&r2=764942&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp Tue Apr 14 20:07:05 2009
@@ -50,13 +50,16 @@
         // parse params out of the properties
         info->setStackTraceEnabled( Boolean::parseBoolean(
             properties.getProperty( "wireFormat.stackTraceEnabled",
-                                    "false" ) ) );
+                                    "true" ) ) );
         info->setCacheEnabled( Boolean::parseBoolean(
             properties.getProperty( "wireFormat.cacheEnabled",
                                     "false" ) ) );
+        info->setCacheSize( Integer::parseInt(
+            properties.getProperty( "wireFormat.cacheSize",
+                                    "1024" ) ) );
         info->setTcpNoDelayEnabled( Boolean::parseBoolean(
             properties.getProperty( "wireFormat.tcpNoDelayEnabled",
-                                    "false" ) ) );
+                                    "true" ) ) );
         info->setTightEncodingEnabled( Boolean::parseBoolean(
             properties.getProperty( "wireFormat.tightEncodingEnabled",
                                     "false" ) ) );