diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-01-11 16:11:12 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-01-11 16:11:12 +0000 |
commit | db22374208796cbd1504640edca2b5bb6f083803 (patch) | |
tree | d8163456a8760bee0bbaedaf0db8cd29e3ed998e | |
parent | 0c36ec4ef4d1a6961773251b0467dcd41df6ee87 (diff) | |
download | qpid-python-db22374208796cbd1504640edca2b5bb6f083803.tar.gz |
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.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@897922 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 16 insertions, 3 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java index af21eb7ed0..9b5277257c 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java @@ -163,7 +163,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec 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? diff --git a/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java b/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java index e5050b4fbd..93ad7e5606 100644 --- a/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java +++ b/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java @@ -68,9 +68,17 @@ public class ClientProperties * 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"; /** * ========================================================== diff --git a/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java b/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java index bd03c3e242..09d91ae6c6 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java +++ b/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java @@ -157,7 +157,12 @@ public class ClientDelegate extends ConnectionDelegate 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; } |