mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
22.14.2007 35c90e29379f29392f4be567966eb2a87a970ba9
Fix a problem in the synchronization stress test where the main thread
was not waiting for the reader thread to complete it's job before
returning the number of message read thus causing the test to fail
1 files modified
36 ■■■■■ changed files
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java 36 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java
@@ -118,19 +118,6 @@
    try {
      /*
       * loop receiving update until there is nothing left
       * to make sure that message from previous tests have been consumed.
       */
      try
      {
        while (true)
        {
          broker.receive();
        }
      }
      catch (Exception e)
      { }
      /*
       * Test that operations done on this server are sent to the
       * changelog server and forwarded to our changelog broker session.
       */
@@ -376,7 +363,10 @@
            break;
          count ++;
        }
      } catch (Exception e) {
      } catch (Exception e)
      {}
      finally
      {
        synchronized (this)
        {
          finished = true;
@@ -393,16 +383,18 @@
    {
      synchronized (this)
      {
        if (finished == true)
          return count;
        try
          int i = 20;
        while ((finished != true) && (i-- >0))
        {
          this.wait(60);
          return count;
        } catch (InterruptedException e)
        {
          return -1;
          try
          {
            this.wait(60000);
          } catch (InterruptedException e)
          {
            return -1;
          }
        }
        return count;
      }
    }