activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: more fixes
Date Sat, 04 Mar 2017 22:24:36 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/artemis-1009 7234cb411 -> 3b7337009


more fixes


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3b733700
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3b733700
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3b733700

Branch: refs/heads/artemis-1009
Commit: 3b733700958e82abb08f2c4efdc5fec8f2147ed1
Parents: 7234cb4
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Sat Mar 4 17:24:27 2017 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Sat Mar 4 17:24:27 2017 -0500

----------------------------------------------------------------------
 .../artemis/core/message/impl/CoreMessage.java   |  3 +++
 .../protocol/amqp/broker/AMQPMessage.java        | 19 ++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3b733700/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index 22f9aa3..d63ec2c 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -384,17 +384,20 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage
{
    @Override
    public CoreMessage setExpiration(long expiration) {
       this.expiration = expiration;
+      messageChanged();
       return this;
    }
 
    @Override
    public CoreMessage setPriority(byte priority) {
       this.priority = priority;
+      messageChanged();
       return this;
    }
 
    public CoreMessage setUserID(UUID userID) {
       this.userID = userID;
+      messageChanged();
       return this;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3b733700/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
index 7578f7f..bb25b21 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
@@ -68,6 +68,7 @@ public class AMQPMessage extends RefCountMessage {
    private MessageAnnotations _messageAnnotations;
    private Properties _properties;
    private ApplicationProperties applicationProperties;
+   private long scheduledTime = -1;
 
    public AMQPMessage(long messageFormat, byte[] data) {
       this.data = Unpooled.wrappedBuffer(data);
@@ -174,7 +175,7 @@ public class AMQPMessage extends RefCountMessage {
       MessageAnnotations annotations = getMessageAnnotations();
       Map mapAnnotations = annotations != null ? annotations.getValue() : null;
       if (mapAnnotations != null) {
-         return mapAnnotations.get(Symbol.getSymbol("x-opt-delivery-time"));
+         return mapAnnotations.get(Symbol.getSymbol(symbol));
       }
 
       return null;
@@ -183,12 +184,20 @@ public class AMQPMessage extends RefCountMessage {
    @Override
    public Long getScheduledDeliveryTime() {
 
-      Object scheduledTime = getSymbol("x-opt-delivery-time");
-      if (scheduledTime != null && scheduledTime instanceof Number) {
-         return ((Number)scheduledTime).longValue();
+      if (scheduledTime < 0) {
+         Object objscheduledTime = getSymbol("x-opt-delivery-time");
+         Object objdelay = getSymbol("x-opt-delivery-delay");
+
+         if (objscheduledTime != null && objscheduledTime instanceof Number) {
+            this.scheduledTime = ((Number) objscheduledTime).longValue();
+         } else if (objdelay != null && objdelay instanceof Number) {
+            this.scheduledTime = System.currentTimeMillis() + ((Number) objdelay).longValue();
+         } else {
+            this.scheduledTime = 0;
+         }
       }
 
-      return null;
+      return scheduledTime == 0 ? null : scheduledTime;
    }
 
    @Override


Mime
View raw message