buff.putLong(message.getMessageID());
message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, bytes);
}
PagedMessage pagedMessage;
if (!message.isDurable())
{
// The address should never be transient when paging (even for non-persistent messages when paging)
// This will force everything to be persisted
message.bodyChanged();
}
if (transactionID != -1)
{
pagedMessage = new PagedMessageImpl(message, transactionID);
}
else
{
pagedMessage = new PagedMessageImpl(message);
}
int bytesToWrite = pagedMessage.getEncodeSize() + PageImpl.SIZE_RECORD;
if (currentPageSize.addAndGet(bytesToWrite) > pageSize && currentPage.getNumberOfMessages() > 0)
{
// Make sure nothing is currently validating or using currentPage
currentPageLock.writeLock().lock();