// Reading is done outside of the synchronized block, however
// the page stays locked until the entire reading is finished
if (needToRead)
{
Page page = null;
try
{
page = pagingStore.createPage((int)pageId);
storageManager.beforePageRead();
page.open();
List<PagedMessage> pgdMessages = page.read(storageManager);
cache.setMessages(pgdMessages.toArray(new PagedMessage[pgdMessages.size()]));
}
finally
{
try
{
if (page != null)
{
page.close();
}
}
catch (Throwable ignored)
{
}