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 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;
|
private long messageSize = -1;
|
||||||
|
|
||||||
|
@ -103,12 +103,19 @@ public class PagedReferenceImpl extends LinkedListImpl.Node<PagedReferenceImpl>
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.message = new WeakReference<>(message);
|
this.message = new WeakReference<>(message);
|
||||||
this.subscription = subscription;
|
this.subscription = subscription;
|
||||||
this.largeMessage = message.getMessage().isLargeMessage();
|
if (message != null) {
|
||||||
this.transactionID = message.getTransactionID();
|
this.largeMessage = message.getMessage().isLargeMessage();
|
||||||
this.messageID = message.getMessage().getMessageID();
|
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
|
//pre-cache the message size so we don't have to reload the message later if it is GC'd
|
||||||
getPersistentSize();
|
getPersistentSize();
|
||||||
|
} else {
|
||||||
|
this.largeMessage = null;
|
||||||
|
this.transactionID = -1;
|
||||||
|
this.messageID = -1;
|
||||||
|
this.messageSize = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -272,16 +279,25 @@ public class PagedReferenceImpl extends LinkedListImpl.Node<PagedReferenceImpl>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLargeMessage() {
|
public boolean isLargeMessage() {
|
||||||
|
if (largeMessage == null && message != null) {
|
||||||
|
largeMessage = getMessage().isLargeMessage();
|
||||||
|
}
|
||||||
return largeMessage;
|
return largeMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getTransactionID() {
|
public long getTransactionID() {
|
||||||
|
if (transactionID < 0) {
|
||||||
|
transactionID = getPagedMessage().getTransactionID();
|
||||||
|
}
|
||||||
return transactionID;
|
return transactionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getMessageID() {
|
public long getMessageID() {
|
||||||
|
if (messageID < 0) {
|
||||||
|
messageID = getPagedMessage().getMessage().getMessageID();
|
||||||
|
}
|
||||||
return messageID;
|
return messageID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue