set new expiration time

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@639499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-20 23:56:18 +00:00
parent f4971bf2dc
commit 47183aeeaa
1 changed files with 9 additions and 1 deletions

View File

@ -39,7 +39,15 @@ public class TimeStampingBrokerPlugin extends BrokerPluginSupport {
if (message.getTimestamp() > 0 if (message.getTimestamp() > 0
&& (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) { && (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) {
// timestamp not been disabled and has not passed through a network // 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); super.send(producerExchange, message);
} }