Package org.exist.storage.lock

Examples of org.exist.storage.lock.LockedDocumentMap


            throws Exception {
        final XQuery xquery = broker.getXQueryService();
        final XQueryPool pool = xquery.getXQueryPool();
       
        checkPragmas(compiled.getContext(), parameters);
        LockedDocumentMap lockedDocuments = null;
        try {
            final long start = System.currentTimeMillis();
            lockedDocuments = beginProtected(broker, parameters);
            if (lockedDocuments != null)
                {compiled.getContext().setProtectedDocs(lockedDocuments);}
            final Properties outputProperties = new Properties();
            final Sequence result = xquery.execute(compiled, contextSet, outputProperties);
            // pass last modified date to the HTTP response
            HTTPUtils.addLastModifiedHeader( result, compiled.getContext() );
            LOG.info("query took " + (System.currentTimeMillis() - start) + "ms.");
            return new QueryResult(result, outputProperties);
        } catch (final XPathException e) {
            return new QueryResult(e);
        } finally {
            if(lockedDocuments != null) {
                lockedDocuments.unlock();
            }
        }
    }
View Full Code Here


        final String protectColl = (String) parameters.get(RpcAPI.PROTECTED_MODE);
        if (protectColl == null)
            {return null;}
        do {
            MutableDocumentSet docs = null;
            final LockedDocumentMap lockedDocuments = new LockedDocumentMap();
            try {
                final Collection coll = broker.getCollection(XmldbURI.createInternal(protectColl));
                docs = new DefaultDocumentSet();
                coll.allDocs(broker, docs, true, lockedDocuments, Lock.WRITE_LOCK);
                return lockedDocuments;
            } catch (final LockException e) {
                LOG.debug("Deadlock detected. Starting over again. Docs: " + docs.getDocumentCount() + "; locked: " +
                lockedDocuments.size());
                lockedDocuments.unlock();
            }
        } while (true);
    }
View Full Code Here

                checkSub(broker, childColl);
            }
        }
   
    MutableDocumentSet childDocs = new DefaultDocumentSet();
    LockedDocumentMap lockedDocuments = new LockedDocumentMap();
    col.getDocuments(broker, childDocs, lockedDocuments, Lock.WRITE_LOCK);
   
    for (Iterator<DocumentImpl> itChildDocs = childDocs.getDocumentIterator(); itChildDocs.hasNext();) {
      DocumentImpl childDoc = itChildDocs.next();
     
View Full Code Here

           
            checkSub(broker, md, childColl);
        }
   
    MutableDocumentSet childDocs = new DefaultDocumentSet();
    LockedDocumentMap lockedDocuments = new LockedDocumentMap();
    col.getDocuments(broker, childDocs, lockedDocuments, Lock.WRITE_LOCK);
   
    for (Iterator<DocumentImpl> itChildDocs = childDocs.getDocumentIterator(); itChildDocs.hasNext();) {
      DocumentImpl childDoc = itChildDocs.next();
     
View Full Code Here

                reservedBroker = brokerPool.get(user);
                deadlockCaught = false;
            MutableDocumentSet docs = null;
              try {
                  final org.exist.collections.Collection coll = collection.getCollection();
                  lockedDocuments = new LockedDocumentMap();
                  docs = new DefaultDocumentSet();
                  coll.allDocs(reservedBroker, docs, true, lockedDocuments, Lock.WRITE_LOCK);
              } catch (final LockException e) {
                  LOG.debug("Deadlock detected. Starting over again. Docs: " + docs.getDocumentCount() + "; locked: " +
                    lockedDocuments.size());
View Full Code Here

TOP

Related Classes of org.exist.storage.lock.LockedDocumentMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.