From 2fd7b3fd77c8141f7fb21d2bd86eb839fa55ef6f Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 13 Oct 2006 21:09:10 +0000 Subject: Pass the internal query executor along when "with" is called, as an optimization. --- src/main/java/com/amazon/carbonado/qe/QueryEngine.java | 13 ++++++++----- src/main/java/com/amazon/carbonado/qe/StandardQuery.java | 12 +++++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/qe') diff --git a/src/main/java/com/amazon/carbonado/qe/QueryEngine.java b/src/main/java/com/amazon/carbonado/qe/QueryEngine.java index 59c9872..56f6145 100644 --- a/src/main/java/com/amazon/carbonado/qe/QueryEngine.java +++ b/src/main/java/com/amazon/carbonado/qe/QueryEngine.java @@ -50,12 +50,12 @@ public class QueryEngine extends StandardQueryFactory } protected StandardQuery createQuery(FilterValues values, OrderingList ordering) { - return new Query(values, ordering); + return new Query(values, ordering, null); } private class Query extends StandardQuery { - Query(FilterValues values, OrderingList ordering) { - super(values, ordering); + Query(FilterValues values, OrderingList ordering, QueryExecutor executor) { + super(values, ordering, executor); } protected Transaction enterTransaction(IsolationLevel level) { @@ -70,8 +70,11 @@ public class QueryEngine extends StandardQueryFactory return mExecutorFactory; } - protected StandardQuery newInstance(FilterValues values, OrderingList ordering) { - return new Query(values, ordering); + protected StandardQuery newInstance(FilterValues values, + OrderingList ordering, + QueryExecutor executor) + { + return new Query(values, ordering, executor); } } } diff --git a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java index 0a4c9d9..d7f5263 100644 --- a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java @@ -61,13 +61,18 @@ public abstract class StandardQuery extends AbstractQuery /** * @param values optional values object, defaults to open filter if null * @param ordering optional order-by properties + * @param executor optional executor to use (by default lazily obtains and caches executor) */ - protected StandardQuery(FilterValues values, OrderingList ordering) { + protected StandardQuery(FilterValues values, + OrderingList ordering, + QueryExecutor executor) + { mValues = values; if (ordering == null) { ordering = OrderingList.emptyList(); } mOrdering = ordering; + mExecutor = executor; } public Class getStorableType() { @@ -429,10 +434,11 @@ public abstract class StandardQuery extends AbstractQuery * @param ordering order-by properties, never null */ protected abstract StandardQuery newInstance(FilterValues values, - OrderingList ordering); + OrderingList ordering, + QueryExecutor executor); private StandardQuery newInstance(FilterValues values) { - return newInstance(values, mOrdering); + return newInstance(values, mOrdering, mExecutor); } private Query createQuery(FilterValues values, OrderingList ordering) -- cgit v1.2.3