summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-01-11 16:11:12 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-01-11 16:11:12 +0000
commitfd6d92c5fb399654fe65fb16d083c785f88dadb9 (patch)
treec87b27181cb42931198f6b8203c8d4c8db649543 /qpid/java
parente1d5ad015d274ea6206e2b6dcf43611b0b801035 (diff)
downloadqpid-python-fd6d92c5fb399654fe65fb16d083c785f88dadb9.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@897922 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java2
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java10
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java7
3 files changed, 16 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
index af21eb7ed0..9b5277257c 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
+++ b/qpid/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/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java b/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
index e5050b4fbd..93ad7e5606 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
+++ b/qpid/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/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
index bd03c3e242..09d91ae6c6 100644
--- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
+++ b/qpid/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;
}