mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user