ALF-12866: WebDAV in-memory locking - threading issues.

* LockInfo instances provide a ReentrantReadWriteLock for clients to use
* LockInfo client code synchronises uses provided RRWLs.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34212 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-02-24 11:28:09 +00:00
parent e579b15f15
commit 894056132b
7 changed files with 368 additions and 197 deletions

View File

@@ -190,18 +190,29 @@ public class PutMethod extends WebDAVMethod
String userName = getDAVHelper().getAuthenticationService().getCurrentUserName();
LockInfo lockInfo = getLockStore().get(contentNodeInfo.getNodeRef());
if (lockInfo != null && lockInfo.isLocked() && !lockInfo.getOwner().equals(userName))
if (lockInfo != null)
{
if (logger.isDebugEnabled())
lockInfo.getRWLock().readLock().lock();
try
{
String path = getPath();
String owner = lockInfo.getOwner();
logger.debug("Node locked: path=["+path+"], owner=["+owner+"], current user=["+userName+"]");
if (lockInfo.isLocked() && !lockInfo.getOwner().equals(userName))
{
if (logger.isDebugEnabled())
{
String path = getPath();
String owner = lockInfo.getOwner();
logger.debug("Node locked: path=["+path+"], owner=["+owner+"], current user=["+userName+"]");
}
// Indicate that the resource is locked
throw new WebDAVServerException(WebDAV.WEBDAV_SC_LOCKED);
}
}
finally
{
lockInfo.getRWLock().readLock().unlock();
}
// Indicate that the resource is locked
throw new WebDAVServerException(WebDAV.WEBDAV_SC_LOCKED);
}
try
{
// Access the content