thomasmueller commented on code in PR #1094:
URL: https://github.com/apache/jackrabbit-oak/pull/1094#discussion_r1440653552
##########
oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/repository/RepositoryImpl.java:
##########
@@ -564,4 +571,30 @@ public synchronized void cancel() {
}
}
}
+
+ /**
+ * This is a fallback implementation of {@link
org.apache.jackrabbit.oak.spi.query.SessionQuerySettingsProvider} that
+ * unifies and replaces the previous handling of {@code
fastQueryResultSize} and {@code oak.fastQuerySize} here
+ * and in the {@link org.apache.jackrabbit.oak.jcr.session.SessionContext}.
+ */
+ private static class FastQuerySizeSettingsProvider implements
SessionQuerySettingsProvider {
+ private final boolean fastQueryResultSize;
+
+ public FastQuerySizeSettingsProvider(boolean fastQueryResultSize) {
+ this.fastQueryResultSize = fastQueryResultSize;
+ }
+
+ @Override
+ public @NotNull SessionQuerySettings getQuerySettings(@NotNull
ContentSession session) {
+ return new SessionQuerySettings() {
+ @Override
+ public boolean useDirectResultCount() {
+ if (System.getProperty("oak.fastQuerySize") != null) {
+ return Boolean.getBoolean("oak.fastQuerySize");
+ }
Review Comment:
I would access the system property only once... Something like this:
```suggestion
String x = System.getProperty("oak.fastQuerySize");
if (x != null) {
return Boolean.parseBoolean(x);
}
```
I know the risk of concurrent change to the system property is tiny... but
still.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]