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();
}
}
}