activemq-artemis git commit: ARTEMIS-1650 Fixing Testsuite on PageReference

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

activemq-artemis git commit: ARTEMIS-1650 Fixing Testsuite on PageReference

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8b4602418 -> 63e0c0d31


ARTEMIS-1650 Fixing Testsuite on PageReference

Transactions may initialize a PagedReference without a valid message yet
during load of prepared transactions.

Caching has to be lazy on this case and it should load on demand.


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

Branch: refs/heads/master
Commit: 63e0c0d310850fb59f800d2cc5cf9c5cfc0060ec
Parents: 8b46024
Author: Clebert Suconic <[hidden email]>
Authored: Fri Feb 9 11:59:45 2018 -0500
Committer: Clebert Suconic <[hidden email]>
Committed: Fri Feb 9 12:09:10 2018 -0500

----------------------------------------------------------------------
 .../core/paging/cursor/PagedReferenceImpl.java  | 32 +++++++++++++++-----
 1 file changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63e0c0d3/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java
index f5d49cf..23f01f9 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java
@@ -53,11 +53,11 @@ public class PagedReferenceImpl extends LinkedListImpl.Node<PagedReferenceImpl>
 
    private Object protocolData;
 
-   private final boolean largeMessage;
+   private Boolean largeMessage;
 
-   private final long transactionID;
+   private long transactionID = -1;
 
-   private final long messageID;
+   private long messageID = -1;
 
    private long messageSize = -1;
 
@@ -103,12 +103,19 @@ public class PagedReferenceImpl extends LinkedListImpl.Node<PagedReferenceImpl>
       this.position = position;
       this.message = new WeakReference<>(message);
       this.subscription = subscription;
-      this.largeMessage = message.getMessage().isLargeMessage();
-      this.transactionID = message.getTransactionID();
-      this.messageID = message.getMessage().getMessageID();
+      if (message != null) {
+         this.largeMessage = message.getMessage().isLargeMessage();
+         this.transactionID = message.getTransactionID();
+         this.messageID = message.getMessage().getMessageID();
 
-      //pre-cache the message size so we don't have to reload the message later if it is GC'd
-      getPersistentSize();
+         //pre-cache the message size so we don't have to reload the message later if it is GC'd
+         getPersistentSize();
+      } else {
+         this.largeMessage = null;
+         this.transactionID = -1;
+         this.messageID = -1;
+         this.messageSize = -1;
+      }
    }
 
    @Override
@@ -272,16 +279,25 @@ public class PagedReferenceImpl extends LinkedListImpl.Node<PagedReferenceImpl>
 
    @Override
    public boolean isLargeMessage() {
+      if (largeMessage == null && message != null) {
+         largeMessage = getMessage().isLargeMessage();
+      }
       return largeMessage;
    }
 
    @Override
    public long getTransactionID() {
+      if (transactionID < 0) {
+         transactionID = getPagedMessage().getTransactionID();
+      }
       return transactionID;
    }
 
    @Override
    public long getMessageID() {
+      if (messageID < 0) {
+         messageID = getPagedMessage().getMessage().getMessageID();
+      }
       return messageID;
    }