activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r764940 - in /activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire: OpenWireFormat.cpp OpenWireFormat.h OpenWireFormatFactory.cpp commands/WireFormatInfo.cpp commands/WireFormatInfo.h
Date Tue, 14 Apr 2009 20:05:00 GMT
Author: tabish
Date: Tue Apr 14 20:05:00 2009
New Revision: 764940

URL: http://svn.apache.org/viewvc?rev=764940&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/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.cpp
    activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.h
    activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
    activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
    activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.h

Modified: activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.cpp?rev=764940&r1=764939&r2=764940&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.cpp
Tue Apr 14 20:05:00 2009
@@ -66,11 +66,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 prefered when the wireformat is negotiated.
@@ -527,4 +530,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/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.h?rev=764940&r1=764939&r2=764940&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormat.h
Tue Apr 14 20:05:00 2009
@@ -220,6 +220,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.
          */
@@ -251,6 +267,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:
 
         /**
@@ -299,8 +347,11 @@
         bool stackTraceEnabled;
         bool tcpNoDelayEnabled;
         bool cacheEnabled;
+        int cacheSize;
         bool tightEncodingEnabled;
         bool sizePrefixDisabled;
+        long long maxInactivityDuration;
+        long long maxInactivityDurationInitialDelay;
 
     };
 

Modified: activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp?rev=764940&r1=764939&r2=764940&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/OpenWireFormatFactory.cpp
Tue Apr 14 20:05:00 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" ) ) );

Modified: activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp?rev=764940&r1=764939&r2=764940&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
Tue Apr 14 20:05:00 2009
@@ -105,8 +105,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<transport::Command>::toString();
     stream << "End Class = WireFormatInfo" << std::endl;
@@ -145,12 +148,21 @@
     if( isCacheEnabled() != wireFormatInfo->isCacheEnabled() ) {
         return false;
     }
+    if( getCacheSize() != wireFormatInfo->getCacheSize() ) {
+        return false;
+    }
     if( isTightEncodingEnabled() != wireFormatInfo->isTightEncodingEnabled() ) {
         return false;
     }
     if( isSizePrefixDisabled() != wireFormatInfo->isSizePrefixDisabled() ) {
         return false;
     }
+    if( getMaxInactivityDuration() != wireFormatInfo->getMaxInactivityDuration() ) {
+        return false;
+    }
+    if( getMaxInactivityDurationInitalDelay() != wireFormatInfo->getMaxInactivityDurationInitalDelay()
) {
+        return false;
+    }
     if( !BaseCommand<transport::Command>::equals( value ) ) {
         return false;
     }
@@ -329,3 +341,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/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.h?rev=764940&r1=764939&r2=764940&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
Tue Apr 14 20:05:00 2009
@@ -164,6 +164,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.
          */



Mime
View raw message