Author: rajith
Date: Mon Jan 11 16:11:12 2010
New Revision: 897922

URL: http://svn.apache.org/viewvc?rev=897922&view=rev
Log:
This is a fix for QPID-2336
The fix allows an idle_timeout of zero to be set as the heartbeat interval with 
a warning message to say heartbeats are disabled.

Modified:
    
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
    
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
    
qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java

Modified: 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java?rev=897922&r1=897921&r2=897922&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
 (original)
+++ 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
 Mon Jan 11 16:11:12 2010
@@ -163,7 +163,7 @@
             else
             {
                 // use the default value set for all connections
-                
this.setIdleTimeout(Long.getLong(ClientProperties.IDLE_TIMEOUT_PROP_NAME,0));
+                
this.setIdleTimeout(Long.getLong(ClientProperties.IDLE_TIMEOUT_PROP_NAME,ClientProperties.DEFAULT_IDLE_TIMEOUT));
             }
             
             String saslMechs = brokerDetail.getProperty("sasl_mechs")!= null?

Modified: 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java?rev=897922&r1=897921&r2=897922&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
 (original)
+++ 
qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
 Mon Jan 11 16:11:12 2010
@@ -68,9 +68,17 @@
      * by the broker in TuneOK it will be used as the heartbeat interval.
      * If not a warning will be printed and the max value specified for
      * heartbeat in TuneOK will be used
+     * 
+     * The default idle timeout is set to 120 secs
      */
     public static final String IDLE_TIMEOUT_PROP_NAME = "idle_timeout";
-
+    public static final long DEFAULT_IDLE_TIMEOUT = 120000;
+    /**
+     * This value will be used to determine the default destination syntax 
type.
+     * Currently the two types are Binding URL (java only) and the Addressing 
format (used by
+     * all clients). 
+     */
+    public static final String DEST_SYNTAX = "dest_syntax";
 
      /**
      * ==========================================================

Modified: 
qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java?rev=897922&r1=897921&r2=897922&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
 (original)
+++ 
qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
 Mon Jan 11 16:11:12 2010
@@ -157,7 +157,12 @@
     private int calculateHeartbeatInterval(Connection conn,int min, int max)
     {
         long l = conn.getIdleTimeout()/1000;
-        if (l !=0 && l >= min && l <= max)
+        if (l == 0)
+        {
+            log.warn("Idle timeout is zero. Heartbeats are disabled");
+            return 0; // heartbeats are disabled.
+        }
+        else if (l >= min && l <= max)
         {
             return (int)l;
         }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to