patsonluk commented on code in PR #909:
URL: https://github.com/apache/solr/pull/909#discussion_r922379034


##########
solr/solrj/src/java/org/apache/solr/common/util/CommonTestInjection.java:
##########
@@ -39,4 +45,31 @@ public static void setAdditionalProps(Map<String, String> 
additionalSystemProps)
   public static Map<String, String> injectAdditionalProps() {
     return additionalSystemProps;
   }
+
+  /**
+   * Set test delay (sleep) in unit of millisec
+   *
+   * @param delay delay in millisec, null to remove such delay
+   */
+  public static void setDelay(Integer delay) {
+    CommonTestInjection.delay = delay;
+  }
+
+  /**
+   * Inject an artificial delay(sleep) into the code
+   *
+   * @return true
+   */
+  public static boolean injectDelay() {
+    if (delay != null) {
+      try {
+        log.info("Start: artificial delay for {}ms", delay);
+        Thread.sleep(delay);
+        log.info("Finish: artificial delay for {}ms", delay);

Review Comment:
   Good point !



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to