From 47183aeeaa2f5d5c3097571443501c653e49fcd4 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Thu, 20 Mar 2008 23:56:18 +0000 Subject: [PATCH] set new expiration time git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@639499 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/broker/util/TimeStampingBrokerPlugin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java b/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java index 2842c66c9b..5ab1c0cfd0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java @@ -39,7 +39,15 @@ public class TimeStampingBrokerPlugin extends BrokerPluginSupport { if (message.getTimestamp() > 0 && (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) { // timestamp not been disabled and has not passed through a network - message.setTimestamp(System.currentTimeMillis()); + long oldExpiration = message.getExpiration(); + long newTimeStamp = System.currentTimeMillis(); + if (oldExpiration > 0) { + long oldTimestamp = message.getTimestamp(); + long timeToLive = oldExpiration-oldTimestamp; + long expiration = timeToLive+newTimeStamp; + message.setExpiration(expiration); + } + message.setTimestamp(newTimeStamp); } super.send(producerExchange, message); }