From: Wolfgang M. M. <wol...@us...> - 2004-08-03 16:46:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25039/src/org/exist/xmldb Modified Files: LocalCollection.java Log Message: All the addDocument methods in org.exist.collections.Collection have been split into two method calls: validate + store. Background: while locking the collection is necessary during validation, this is not really required while the document is being stored. The caller can thus release the lock after validate has completed. Index: LocalCollection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollection.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** LocalCollection.java 3 Aug 2004 15:25:57 -0000 1.37 --- LocalCollection.java 3 Aug 2004 16:45:45 -0000 1.38 *************** *** 39,42 **** --- 39,43 ---- import org.exist.Indexer; import org.exist.collections.Collection; + import org.exist.collections.IndexInfo; import org.exist.collections.triggers.TriggerException; import org.exist.dom.BinaryDocument; *************** *** 569,573 **** DocumentImpl newDoc; Collection collection = broker.openCollection(path, Lock.WRITE_LOCK); ! Indexer indexer = null; try { if(collection == null) --- 570,574 ---- DocumentImpl newDoc; Collection collection = broker.openCollection(path, Lock.WRITE_LOCK); ! IndexInfo info = null; try { if(collection == null) *************** *** 579,594 **** } if (uri != null) { ! indexer = collection.validate(broker, name, new InputSource(uri)); } else if (res.root != null) ! newDoc = collection.addDocument(broker, name, res.root); else ! indexer = collection.validate(broker, name, res.content); } finally { collection.release(); } if (uri != null) { ! collection.store(broker, indexer, new InputSource(uri), false); ! } else ! collection.store(broker, indexer, res.content, false); collection.deleteObservers(); } catch (Exception e) { --- 580,598 ---- } if (uri != null) { ! info = collection.validate(broker, name, new InputSource(uri)); } else if (res.root != null) ! info = collection.validate(broker, name, res.root); else ! info = collection.validate(broker, name, res.content); } finally { collection.release(); } if (uri != null) { ! collection.store(broker, info, new InputSource(uri), false); ! } else if (res.root != null) { ! collection.store(broker, info, res.root, false); ! } else { ! collection.store(broker, info, res.content, false); ! } collection.deleteObservers(); } catch (Exception e) { |