From: Wolfgang M. M. <wol...@us...> - 2004-08-03 15:26:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8244/src/org/exist/http/webdav Modified Files: WebDAV.java Log Message: Revised collection locking to fix various concurrency errors. It is now the responsibility of the caller to lock/unlock a collection. A collection can be retrieved and locked via the new openCollection() method provided by DBBroker. After reading/modifying the collection, it should be unlocked by calling Collection.release. The local XML:DB implementation and the XMLRPC interface have been changed to reflect the new collection locking rules. Index: WebDAV.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/WebDAV.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WebDAV.java 21 Jun 2004 15:27:40 -0000 1.5 --- WebDAV.java 3 Aug 2004 15:26:00 -0000 1.6 *************** *** 43,46 **** --- 43,47 ---- import org.exist.storage.DBBroker; import org.exist.storage.serializers.EXistOutputKeys; + import org.exist.util.Lock; /** *************** *** 122,131 **** broker = pool.get(user); - collection = broker.getCollection(path); - if(collection == null) { - resource = (DocumentImpl)broker.getDocument(path); - if(resource != null) - collection = resource.getCollection(); - } method = WebDAVMethodFactory.create(request.getMethod(), pool); if(method == null) { --- 123,126 ---- *************** *** 134,137 **** --- 129,138 ---- return; } + collection = broker.openCollection(path, Lock.READ_LOCK); + if(collection == null) { + resource = (DocumentImpl)broker.openDocument(path, Lock.READ_LOCK); + if(resource != null) + collection = resource.getCollection(); + } } catch (EXistException e) { throw new ServletException("An error occurred while retrieving resource: " + e.getMessage(), e); *************** *** 141,145 **** pool.release(broker); } ! method.process(user, request, response, collection, resource); } --- 142,153 ---- pool.release(broker); } ! try { ! method.process(user, request, response, collection, resource); ! } finally { ! if(collection != null) ! collection.release(); ! if(resource != null) ! resource.getUpdateLock().release(); ! } } |