You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/11/11 20:58:23 UTC

[GitHub] [solr] mkhludnev commented on a change in pull request #376: SOLR-15635: don't repeat close hooks if SRI cleared twice

mkhludnev commented on a change in pull request #376:
URL: https://github.com/apache/solr/pull/376#discussion_r747812872



##########
File path: solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
##########
@@ -95,25 +99,33 @@ public static void clearRequestInfo() {
    * we expect it to be empty by now because all "set" calls need to be balanced with a "clear".
    */
   public static void reset() {
+    log.trace("reset()");
     Deque<SolrRequestInfo> stack = threadLocal.get();
-    boolean isEmpty = stack.isEmpty();
+    assert stack.isEmpty() : "SolrRequestInfo Stack should have been cleared.";
     while (!stack.isEmpty()) {
       SolrRequestInfo info = stack.pop();
-      closeHooks(info);
+      info.close();
     }
-    assert isEmpty : "SolrRequestInfo Stack should have been cleared.";
   }
 
-  private static void closeHooks(SolrRequestInfo info) {
-    if (info.closeHooks != null) {
-      for (Closeable hook : info.closeHooks) {
+  private synchronized void close() {

Review comment:
       Reducing synchronized scope to condition seems working. Is it worth to push into PRs' branch.




-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org