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/07/12 15:55:20 UTC

[lucene-solr] branch reference_impl updated: #91 Let's get ready to start some real policeman work.

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

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 900fce1  #91 Let's get ready to start some real policeman work.
900fce1 is described below

commit 900fce1d17a8ce4e00626e550ba671e3b87c198d
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Jul 12 10:54:58 2020 -0500

    #91 Let's get ready to start some real policeman work.
---
 .../java/org/apache/solr/common/TimeTracker.java   |  2 +-
 .../src/java/org/apache/solr/SolrTestCase.java     | 32 ++++++++++++++++++++--
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/TimeTracker.java b/solr/solrj/src/java/org/apache/solr/common/TimeTracker.java
index bcfa64d..bea8176 100644
--- a/solr/solrj/src/java/org/apache/solr/common/TimeTracker.java
+++ b/solr/solrj/src/java/org/apache/solr/common/TimeTracker.java
@@ -150,7 +150,7 @@ public class TimeTracker {
 
     String times = getCloseTimes();
     if (times.trim().length()>0) {
-      System.out.println("\n------\n" +  times + "\n------\n");
+      System.out.println("\n------" +  times + "------\n");
     }
 
     if (log.isDebugEnabled()) {
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index ee5c9d6..a009869 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -313,7 +313,7 @@ public class SolrTestCase extends LuceneTestCase {
   }
   
   @AfterClass
-  public static void shutdownLogger() throws Exception {
+  public static void afterSolrTestCase() throws Exception {
 
     try {
       HttpClientUtil.resetHttpClientBuilder();
@@ -332,8 +332,34 @@ public class SolrTestCase extends LuceneTestCase {
 //                  + testTime);
       }
     } finally {
-      // nocommit - this should not be necessary, check
-      TimeTracker.CLOSE_TIMES.clear();
+      System.out.println("Show Close Times");
+      Class<? extends Object> clazz = null;
+      Long tooLongTime = 0L;
+      try {
+        synchronized (TimeTracker.CLOSE_TIMES) {
+          Map<String,TimeTracker> closeTimes = TimeTracker.CLOSE_TIMES;
+          for (TimeTracker closeTime : closeTimes.values()) {
+//              if (closeTime.getClazz() == SolrCore.class) {
+//                continue;
+//              }
+            if (closeTime.getElapsedMS() > 8000) {
+              tooLongTime = closeTime.getElapsedMS();
+              clazz = closeTime.getClazz();
+            }
+            closeTime.printCloseTimes();
+            System.out.println("\n");
+          }
+        }
+
+      } finally {
+        TimeTracker.CLOSE_TIMES.clear();
+      }
+
+      if (clazz != null) {
+        // nocommit - leave this on
+        fail("A " + clazz.getName() + " took too long to close: " + tooLongTime);
+      }
+
     }
   }