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

brandonwilliams pushed a commit to branch cassandra-4.1
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 8f47d232faeacb44087712dd5524db96d92aae46
Merge: e12dc48c87 70478a1578
Author: Brandon Williams <[email protected]>
AuthorDate: Wed Nov 9 11:59:49 2022 -0600

    Merge branch 'cassandra-4.0' into cassandra-4.1

 .../commitlog/CommitLogInitWithExceptionTest.java  | 32 +++++-----------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --cc 
test/unit/org/apache/cassandra/db/commitlog/CommitLogInitWithExceptionTest.java
index fbad0b4857,21d207bea2..b3cff94c66
--- 
a/test/unit/org/apache/cassandra/db/commitlog/CommitLogInitWithExceptionTest.java
+++ 
b/test/unit/org/apache/cassandra/db/commitlog/CommitLogInitWithExceptionTest.java
@@@ -19,6 -19,6 +19,8 @@@
  package org.apache.cassandra.db.commitlog;
  
  
++import org.apache.cassandra.Util;
++import org.apache.cassandra.utils.concurrent.Condition;
  import org.junit.Assert;
  import org.junit.BeforeClass;
  import org.junit.Test;
@@@ -27,12 -27,14 +29,13 @@@ import org.apache.cassandra.CassandraIs
  import org.apache.cassandra.config.Config;
  import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.utils.JVMStabilityInspector;
 -import org.apache.cassandra.utils.concurrent.SimpleCondition;
 +
+ 
  @RunWith(CassandraIsolatedJunit4ClassRunner.class)
  public class CommitLogInitWithExceptionTest
  {
 -    private final static SimpleCondition killed = new SimpleCondition();
 -
 +    private static Thread initThread;
- 
++    private final static Condition killed = Condition.newOneTimeCondition();
      @BeforeClass
      public static void setUp()
      {
@@@ -56,41 -58,20 +59,20 @@@
              }
              finally
              {
-                 Assert.assertNotNull(initThread);
-                 // We have to manually stop init thread because the JVM does 
not exit actually.
-                 initThread.stop();
 -                killed.signalAll();
++                killed.signal();
              }
          };
      }
  
-     @Test(timeout = 30000)
+     @Test
      public void testCommitLogInitWithException() {
          // This line will trigger initialization process because it's the 
first time to access CommitLog class.
 -        Thread initThread = new Thread(CommitLog.instance::start);
 +        initThread = new Thread(CommitLog.instance::start);
  
          initThread.setName("initThread");
          initThread.start();
  
-         try
-         {
-             initThread.join(); // Should not block here
-         }
-         catch (InterruptedException expected)
-         {
-         }
- 
-         Assert.assertFalse(initThread.isAlive());
- 
-         try
-         {
-             Thread.sleep(1000); // Wait for COMMIT-LOG-ALLOCATOR exit
-         }
-         catch (InterruptedException e)
-         {
-             Assert.fail();
-         }
- 
-         
Assert.assertTrue(CommitLog.instance.segmentManager.executor.isTerminated()); 
// exit successfully
 -        Util.spinAssertEquals(true, killed::isSignaled, 120);
++        Util.spinAssertEquals(true, killed::isSignalled, 10);
      }
  
      private static class MockCommitLogSegmentMgr extends 
CommitLogSegmentManagerStandard {


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

Reply via email to