mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
60652: Precautions against MNT-10486: NPE in NodeEntity during post-commit write through to shared cache - Ensure that NodeEntity objects are locked before going into cache (missed locks during bulk loading) - Do check on validity of NodeEntity during lock git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62355 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1058,6 +1058,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
}
|
}
|
||||||
Long nodeId = dbNode.getId();
|
Long nodeId = dbNode.getId();
|
||||||
invalidateNodeCaches(nodeId);
|
invalidateNodeCaches(nodeId);
|
||||||
|
dbNode.lock(); // Prevent unexpected edits of values going into the cache
|
||||||
nodesCache.setValue(nodeId, dbNode);
|
nodesCache.setValue(nodeId, dbNode);
|
||||||
return dbNode.getNodePair();
|
return dbNode.getNodePair();
|
||||||
}
|
}
|
||||||
@@ -1159,6 +1160,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
logger.debug("Repairing stale cache entry for node: " + nodeId);
|
logger.debug("Repairing stale cache entry for node: " + nodeId);
|
||||||
}
|
}
|
||||||
invalidateNodeCaches(nodeId);
|
invalidateNodeCaches(nodeId);
|
||||||
|
dbNode.lock(); // Prevent unexpected edits of values going into the cache
|
||||||
nodesCache.setValue(nodeId, dbNode);
|
nodesCache.setValue(nodeId, dbNode);
|
||||||
return dbNode.getNodePair();
|
return dbNode.getNodePair();
|
||||||
}
|
}
|
||||||
@@ -4632,6 +4634,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
{
|
{
|
||||||
Long nodeId = node.getId();
|
Long nodeId = node.getId();
|
||||||
NodeVersionKey nodeVersionKey = node.getNodeVersionKey();
|
NodeVersionKey nodeVersionKey = node.getNodeVersionKey();
|
||||||
|
node.lock(); // Prevent unexpected edits of values going into the cache
|
||||||
nodesCache.setValue(nodeId, node);
|
nodesCache.setValue(nodeId, node);
|
||||||
if (propertiesCache.getValue(nodeVersionKey) == null)
|
if (propertiesCache.getValue(nodeVersionKey) == null)
|
||||||
{
|
{
|
||||||
|
@@ -150,6 +150,11 @@ public class NodeEntity implements Node, PermissionCheckValue, Serializable
|
|||||||
{
|
{
|
||||||
auditableProperties.lock();
|
auditableProperties.lock();
|
||||||
}
|
}
|
||||||
|
// Help to avoid NPEs e.g. MNT-10486: NPE in NodeEntity during post-commit write through to shared cache
|
||||||
|
if (id == null || version == null)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("The NodeEntity has not be filled: " + this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized final void checkLock()
|
private synchronized final void checkLock()
|
||||||
|
Reference in New Issue
Block a user