You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/08/12 12:38:49 UTC

[lucene-solr] branch reference_impl_dev updated: @529 This APIBag stuff sure does make a LOT of method calls.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 489c2a2  @529 This APIBag stuff sure does make a LOT of method calls.
489c2a2 is described below

commit 489c2a25d180e6c7e6a02b340aba89cdb09c4eec
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Aug 12 07:34:08 2020 -0500

    @529 This APIBag stuff sure does make a LOT of method calls.
---
 .../java/org/apache/solr/common/util/ValidatingJsonMap.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ValidatingJsonMap.java b/solr/solrj/src/java/org/apache/solr/common/util/ValidatingJsonMap.java
index ef370b5..d7397d0 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ValidatingJsonMap.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ValidatingJsonMap.java
@@ -284,10 +284,12 @@ public class ValidatingJsonMap implements Map<String, Object>, NavigableObject {
       map.putAll(includedMap);
     }
     if (maxDepth > 0) {
-      map.entrySet().stream()
-          .filter(e -> e.getValue() instanceof Map)
-          .map(Map.Entry::getValue)
-          .forEach(m -> handleIncludes((ValidatingJsonMap) m, loc, maxDepth - 1));
+      ParWork.getExecutor().submit(() -> {
+        map.entrySet().parallelStream()
+            .filter(e -> e.getValue() instanceof Map)
+            .map(Map.Entry::getValue)
+            .forEach(m -> handleIncludes((ValidatingJsonMap) m, loc, maxDepth - 1));
+      });
     }
   }
 
@@ -334,7 +336,7 @@ public class ValidatingJsonMap implements Map<String, Object>, NavigableObject {
       throw new RuntimeException("invalid API spec: " + resourceName);
     }
     ValidatingJsonMap map = null;
-    try (InputStream is = new BufferedInputStream(resource.openStream())) {
+    try (InputStream is = resource.openStream()) { // a buffered reader is used to parse the json
       try {
         map = fromJSON(is, includeLocation);
       } catch (Exception e) {