activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r639499 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
Date Thu, 20 Mar 2008 23:56:19 GMT
Author: rajdavies
Date: Thu Mar 20 16:56:18 2008
New Revision: 639499

URL: http://svn.apache.org/viewvc?rev=639499&view=rev
Log:
set new expiration time

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java?rev=639499&r1=639498&r2=639499&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
Thu Mar 20 16:56:18 2008
@@ -39,7 +39,15 @@
         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);
     }



Mime
View raw message