Fixed unreported error: New transactions started in the post-commit phase *might* see stale cache data

- Transactional caches were flushing last in the post-commit phase
 - New transactions in the post-commit phase would see cache data out of synch with the DB-committed data
 - Affects DOD5015 post-commit audit actions, which were not generating full datasets for the first-pass data import

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16627 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-30 15:41:37 +00:00
parent 8a1a86dc0f
commit 77457e3670
3 changed files with 172 additions and 107 deletions

View File

@@ -778,6 +778,26 @@ public abstract class AlfrescoTransactionSupport
logger.debug("After completion (" + statusStr + "): " + this);
}
// Clean up the transactional caches
for (TransactionalCache<Serializable, Object> cache : transactionalCaches)
{
try
{
if (status == TransactionSynchronization.STATUS_COMMITTED)
{
cache.afterCommit();
}
else
{
cache.afterRollback();
}
}
catch (RuntimeException e)
{
logger.error("After completion (" + statusStr + ") TransactionalCache exception", e);
}
}
List<TransactionListener> iterableListeners = getListenersIterable();
// notify listeners
if (status == TransactionSynchronization.STATUS_COMMITTED)
@@ -833,26 +853,6 @@ public abstract class AlfrescoTransactionSupport
}
}
// Clean up the transactional caches
for (TransactionalCache<Serializable, Object> cache : transactionalCaches)
{
try
{
if (status == TransactionSynchronization.STATUS_COMMITTED)
{
cache.afterCommit();
}
else
{
cache.afterRollback();
}
}
catch (RuntimeException e)
{
logger.error("After completion (" + statusStr + ") TransactionalCache exception", e);
}
}
// clear the thread's registrations and synchronizations
AlfrescoTransactionSupport.clearSynchronization();
}