summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/qe
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/amazon/carbonado/qe')
-rw-r--r--src/main/java/com/amazon/carbonado/qe/QueryEngine.java13
-rw-r--r--src/main/java/com/amazon/carbonado/qe/StandardQuery.java12
2 files changed, 17 insertions, 8 deletions
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<S extends Storable> extends StandardQueryFactory<S>
}
protected StandardQuery<S> createQuery(FilterValues<S> values, OrderingList<S> ordering) {
- return new Query(values, ordering);
+ return new Query(values, ordering, null);
}
private class Query extends StandardQuery<S> {
- Query(FilterValues<S> values, OrderingList<S> ordering) {
- super(values, ordering);
+ Query(FilterValues<S> values, OrderingList<S> ordering, QueryExecutor<S> executor) {
+ super(values, ordering, executor);
}
protected Transaction enterTransaction(IsolationLevel level) {
@@ -70,8 +70,11 @@ public class QueryEngine<S extends Storable> extends StandardQueryFactory<S>
return mExecutorFactory;
}
- protected StandardQuery<S> newInstance(FilterValues<S> values, OrderingList<S> ordering) {
- return new Query(values, ordering);
+ protected StandardQuery<S> newInstance(FilterValues<S> values,
+ OrderingList<S> ordering,
+ QueryExecutor<S> 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<S extends Storable> extends AbstractQuery<S>
/**
* @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<S> values, OrderingList<S> ordering) {
+ protected StandardQuery(FilterValues<S> values,
+ OrderingList<S> ordering,
+ QueryExecutor<S> executor)
+ {
mValues = values;
if (ordering == null) {
ordering = OrderingList.emptyList();
}
mOrdering = ordering;
+ mExecutor = executor;
}
public Class<S> getStorableType() {
@@ -429,10 +434,11 @@ public abstract class StandardQuery<S extends Storable> extends AbstractQuery<S>
* @param ordering order-by properties, never null
*/
protected abstract StandardQuery<S> newInstance(FilterValues<S> values,
- OrderingList<S> ordering);
+ OrderingList<S> ordering,
+ QueryExecutor<S> executor);
private StandardQuery<S> newInstance(FilterValues<S> values) {
- return newInstance(values, mOrdering);
+ return newInstance(values, mOrdering, mExecutor);
}
private Query<S> createQuery(FilterValues<S> values, OrderingList<S> ordering)