Lock lock = collectionsDb.getLock(); try { lock.acquire(Lock.WRITE_LOCK); storeDocument(doc); saveCollection(doc.getCollection()); } finally { lock.release(); }
storeDocument(doc); saveCollection(doc.getCollection());
	public void updateDocument(DocumentImpl doc) throws LockException, PermissionDeniedException {		Lock lock = collectionsDb.getLock();		try {			lock.acquire(Lock.WRITE_LOCK);			storeDocument(doc);			saveCollection(doc.getCollection());		} finally {			lock.release();		}	}