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.
This commit is contained in:
parent
8b46024181
commit
63e0c0d310
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue