jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1186248 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryObjectModelImpl.java
Date Wed, 19 Oct 2011 14:53:07 GMT
Author: alexparvulescu
Date: Wed Oct 19 14:53:07 2011
New Revision: 1186248

URL: http://svn.apache.org/viewvc?rev=1186248&view=rev
Log:
JCR-3122 QueryObjectModelImpl should execute queries as SessionOperation(s)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryObjectModelImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryObjectModelImpl.java?rev=1186248&r1=1186247&r2=1186248&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryObjectModelImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryObjectModelImpl.java
Wed Oct 19 14:53:07 2011
@@ -35,6 +35,7 @@ import org.apache.jackrabbit.core.query.
 import org.apache.jackrabbit.core.query.lucene.SearchIndex;
 import org.apache.jackrabbit.core.query.lucene.join.QueryEngine;
 import org.apache.jackrabbit.core.session.SessionContext;
+import org.apache.jackrabbit.core.session.SessionOperation;
 import org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl;
 import org.apache.jackrabbit.spi.commons.query.qom.DefaultTraversingQOMTreeVisitor;
 import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
@@ -116,16 +117,25 @@ public class QueryObjectModelImpl extend
     }
 
     public QueryResult execute() throws RepositoryException {
-        QueryEngine engine = new QueryEngine(sessionContext.getSessionImpl(),
-                lqf, variables);
         long time = System.currentTimeMillis();
-        QueryResult qr = engine.execute(getColumns(), getSource(),
-                getConstraint(), getOrderings(), offset, limit);
+        final QueryResult result = sessionContext.getSessionState().perform(
+                new SessionOperation<QueryResult>() {
+                    public QueryResult perform(SessionContext context)
+                            throws RepositoryException {
+                        final QueryEngine engine = new QueryEngine(
+                                sessionContext.getSessionImpl(), lqf, variables);
+                        return engine.execute(getColumns(), getSource(),
+                                getConstraint(), getOrderings(), offset, limit);
+                    }
+                    public String toString() {
+                        return "query.execute(" + statement + ")";
+                    }
+                });
         if (log.isDebugEnabled()) {
             time = System.currentTimeMillis() - time;
             log.debug("executed in {} ms. ({})", time, statement);
         }
-        return qr;
+        return result;
     }
 
     @Override



Mime
View raw message