diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2009-06-03 19:22:27 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2009-06-03 19:22:27 +0000 |
commit | aadc256659f53ad8f2739462265aa6f05d306101 (patch) | |
tree | 20821ff8d1ada9ec30a727496942e0d0b4aa3941 | |
parent | c54cb56e0ab47bba8aca105e94164eb33c52b2d0 (diff) | |
download | qpid-python-aadc256659f53ad8f2739462265aa6f05d306101.tar.gz |
This is related to QPID-1887
I incorporated the review comments and made the following changes.
The current time is generated only if ttl is set or disable Timestamp is set to false.
If ttl is set we set it and also calculate the expiration as current_time + ttl.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@781515 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index 22824d9f1c..9f8c783b4b 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -92,18 +92,22 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer messageProps.clearMessageId(); } + long currentTime = 0; + if (timeToLive > 0 || !_disableTimestamps) + { + currentTime = System.currentTimeMillis(); + } + + if (timeToLive > 0) + { + deliveryProp.setTtl(timeToLive); + message.setJMSExpiration(currentTime + timeToLive); + } + if (!_disableTimestamps) { - final long currentTime = System.currentTimeMillis(); - deliveryProp.setTimestamp(currentTime); - if (timeToLive > 0) - { - deliveryProp.setTtl(timeToLive); - } - else - { - deliveryProp.setTtl(0); - } + + deliveryProp.setTimestamp(currentTime); message.setJMSTimestamp(currentTime); } |