ctubbsii commented on a change in pull request #1816:
URL: https://github.com/apache/accumulo/pull/1816#discussion_r532828863



##########
File path: 
server/base/src/test/java/org/apache/accumulo/server/util/time/SimpleTimerTest.java
##########
@@ -98,11 +97,15 @@ public void testFailure() throws InterruptedException {
     assertTrue(r.wasRun);
   }
 
-  @Test
-  public void testSingleton() {
-    assertEquals(1, SimpleTimer.getInstanceThreadPoolSize());
-    SimpleTimer t2 = SimpleTimer.getInstance(2);
-    assertSame(t, t2);
+  @Test(timeout = 5000)
+  public void testSingleton() throws InterruptedException {
+    while (true) {
+      SimpleTimer t2 = SimpleTimer.getInstance(2);
+      if((SimpleTimer.getInstanceThreadPoolSize() == 1) && (t == t2)) {
+        break;
+      }
+      Thread.sleep(PAD);
+    }

Review comment:
       This is the right strategy (albeit with a few extra parenthesis than 
necessary on that `if` statement :wink: )




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to