Message timestamp is now a long (instead of java.util.Date).

This commit is contained in:
Mark Fisher
2008-07-15 19:16:52 +00:00
parent cb7fe54f17
commit 0056edd10d
4 changed files with 7 additions and 9 deletions

View File

@@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentMap;
*/
public class DefaultMessageHeader implements MessageHeader, Serializable {
private final Date timestamp = new Date();
private final long timestamp = System.currentTimeMillis();
private volatile Date expiration;
@@ -51,9 +51,9 @@ public class DefaultMessageHeader implements MessageHeader, Serializable {
/**
* Return the creation time of this message.
* Return the creation time of this message (in milliseconds).
*/
public Date getTimestamp() {
public long getTimestamp() {
return this.timestamp;
}

View File

@@ -30,7 +30,7 @@ import java.util.Set;
*/
public interface MessageHeader {
Date getTimestamp();
long getTimestamp();
Date getExpiration();

View File

@@ -116,7 +116,7 @@ public class WireTapTests {
Message<?> original = mainChannel.receive(0);
Message<?> duplicate = secondaryChannel.receive(0);
assertTrue("original timestamp should precede duplicate",
original.getHeader().getTimestamp().before(duplicate.getHeader().getTimestamp()));
original.getHeader().getTimestamp() < duplicate.getHeader().getTimestamp());
}
public void testDuplicateMessageContainsAttribute() {