Example #1
1
 private void checkTokenLoad(String datadir) {
   System.err.println("Checking Token table load");
   SQLDB.loadFile(datadir + "loadTKTest", "Token");
   try {
     ResultSet t = SQLDB.queryDatabase("SELECT * FROM Token");
     t.last();
     assertTrue(t.getInt("TokenId") == 1);
     assertTrue(t.getInt("TokenType") == 1);
     assertTrue(t.getInt("SlotId") == 1);
     assertTrue(t.getInt("SlotIndex") == 1);
     assertTrue(t.getLong("PartialPlanId") == 1L);
     assertTrue(t.getBoolean("IsFreeToken"));
     assertTrue(t.getBoolean("IsValueToken"));
     assertTrue(t.getInt("StartVarId") == 1);
     assertTrue(t.getInt("EndVarId") == 1);
     assertTrue(t.getInt("DurationVarId") == 1);
     assertTrue(t.getInt("StateVarId") == 1);
     assertTrue(t.getString("PredicateName").equals("1"));
     assertTrue(t.getInt("ParentId") == 1);
     assertTrue(t.getString("ParentName").equals("1"));
     assertTrue(t.getInt("ObjectVarId") == 1);
     assertTrue(t.getString("ParamVarIds").equals("1"));
     assertTrue(t.getString("ExtraData").equals("1"));
   } catch (SQLException sqle) {
     sqle.printStackTrace();
     System.exit(-1);
   }
   SQLDB.updateDatabase("DELETE FROM Token");
 }
Example #2
0
 public static String[] getClassRoots() {
   String testRoots = System.getProperty("test.roots");
   if (testRoots != null) {
     System.out.println(
         "Collecting tests from roots specified by test.roots property: " + testRoots);
     return testRoots.split(";");
   }
   final String[] roots = ExternalClasspathClassLoader.getRoots();
   if (roots != null) {
     System.out.println(
         "Collecting tests from roots specified by classpath.file property: "
             + Arrays.toString(roots));
     return roots;
   } else {
     final ClassLoader loader = TestAll.class.getClassLoader();
     if (loader instanceof URLClassLoader) {
       final URL[] urls = ((URLClassLoader) loader).getURLs();
       final String[] classLoaderRoots = new String[urls.length];
       for (int i = 0; i < urls.length; i++) {
         classLoaderRoots[i] = VfsUtil.urlToPath(VfsUtil.convertFromUrl(urls[i]));
       }
       System.out.println(
           "Collecting tests from classloader: " + Arrays.toString(classLoaderRoots));
       return classLoaderRoots;
     }
     return System.getProperty("java.class.path").split(File.pathSeparator);
   }
 }
Example #3
0
  public void testCreateDir() {
    System.out.println("testCreateDir");
    String fs, dir, path_synarcher, path, path_test_kleinberg;

    fs = System.getProperty("file.separator");
    dir = System.getProperty("user.home") + fs;

    // creates ~/.synarcher/
    path_synarcher = dir + ".synarcher" + fs;
    path = path_synarcher + "test.txt";
    FileWriter.createDir(path);

    // creates ~/.synarcher/graphviz/
    path = path_synarcher + "graphviz" + fs + "test.txt";
    FileWriter.createDir(path);

    // creates ~/.synarcher/test_kleinberg/
    path_test_kleinberg = path_synarcher + "test_kleinberg" + fs;
    path = path_test_kleinberg + "test.txt";
    FileWriter.createDir(path);

    // creates ~/.synarcher/test_kleinberg/en/
    path_test_kleinberg = path_synarcher + "test_kleinberg" + fs;
    path = path_test_kleinberg + "en" + fs + "test.txt";
    FileWriter.createDir(path);

    // creates ~/.synarcher/test_kleinberg/ru/
    path_test_kleinberg = path_synarcher + "test_kleinberg" + fs;
    path = path_test_kleinberg + "ru" + fs + "test.txt";
    FileWriter.createDir(path);
  }
Example #4
0
  public void testLoadFile() {
    try {
      String datadir =
          System.getProperty("planworks.test.data.dir")
              .concat(System.getProperty("file.separator"))
              .concat("loadTest")
              .concat(System.getProperty("file.separator"));
      checkConstraintLoad(datadir);
      checkConstraintVarMapLoad(datadir);
      checkObjectLoad(datadir);
      checkPartialPlanLoad(datadir);
      checkProjectLoad(datadir);
      checkSequenceLoad(datadir);
      checkTokenLoad(datadir);
      checkVariableLoad(datadir);
      // checkTransactionLoad(datadir);
      checkPartialPlanStatsLoad(datadir);
      checkResourceInstantsLoad(datadir);
      checkRulesLoad(datadir);
      checkRuleInstanceLoad(datadir);
      checkDecisionLoad(datadir);

      // catch assert errors and Exceptions here, since JUnit seems to not do it
    } catch (AssertionFailedError err) {
      err.printStackTrace();
      System.exit(-1);
    } catch (Exception excp) {
      excp.printStackTrace();
      System.exit(-1);
    }
  }
Example #5
0
  private void testPageTemplate(String test, Map<String, Object> dictionary) throws Exception {
    String jpt = "/" + test + ".jpt";
    long start = System.currentTimeMillis();
    PageTemplate template = new PageTemplateImpl(getClass().getResource(jpt));
    long elapsed = System.currentTimeMillis() - start;
    System.err.println(test + ": constructed template in " + elapsed + " ms");

    TestObject testObject = new TestObject();
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();

    start = System.currentTimeMillis();
    if (dictionary == null) {
      template.process(buffer, testObject);
    } else {
      template.process(buffer, testObject, dictionary);
    }
    elapsed = System.currentTimeMillis() - start;
    System.err.println(test + ": processed template in " + elapsed + " ms");

    String html = "/" + test + ".html";
    String newHtml = "???";
    byte[] resultBinary = buffer.toByteArray();
    String result = fixCRLF(new String(resultBinary, "UTF-8"));
    String expected = fixCRLF(loadTextFile(getClass().getResourceAsStream(html)));
    if (!result.equals(expected)) {
      newHtml = getClass().getResource(html).getPath() + ".new";
      FileOutputStream out = new FileOutputStream(newHtml);
      out.write(resultBinary);
      out.close();
    }
    assertTrue("unexpected results: see " + newHtml, result.equals(expected));
  }
  /**
   * Runs Runnable r with a security policy that permits precisely the specified permissions. If
   * there is no current security manager, the runnable is run twice, both with and without a
   * security manager. We require that any security manager permit getPolicy/setPolicy.
   */
  public void runWithPermissions(Runnable r, Permission... permissions) {
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
      r.run();
      Policy savedPolicy = Policy.getPolicy();
      try {
        Policy.setPolicy(permissivePolicy());
        System.setSecurityManager(new SecurityManager());
        runWithPermissions(r, permissions);
      } finally {
        System.setSecurityManager(null);
        Policy.setPolicy(savedPolicy);
      }
    } else {
      Policy savedPolicy = Policy.getPolicy();
      AdjustablePolicy policy = new AdjustablePolicy(permissions);
      Policy.setPolicy(policy);

      try {
        r.run();
      } finally {
        policy.addPermission(new SecurityPermission("setPolicy"));
        Policy.setPolicy(savedPolicy);
      }
    }
  }
  /**
   * A method that would simply send messages to a group of people so that they would get notified
   * that tests are being run.
   */
  public void testSendFunMessages() {
    String hostname = "";

    try {
      hostname = java.net.InetAddress.getLocalHost().getHostName() + ": ";
    } catch (UnknownHostException ex) {
    }

    String message =
        hostname
            + "Hello this is the SIP Communicator (version "
            + System.getProperty("sip-communicator.version")
            + ") build on: "
            + new Date().toString()
            + ". Have a very nice day!";

    String list = System.getProperty("accounts.reporting.ICQ_REPORT_LIST");

    logger.debug("Will send message " + message + " to: " + list);

    // if no property is specified - return
    if (list == null || list.trim().length() == 0) return;

    StringTokenizer tokenizer = new StringTokenizer(list, " ");

    while (tokenizer.hasMoreTokens()) {
      fixture.testerAgent.sendMessage(tokenizer.nextToken(), message);
    }
  }
 public void testReadDirectory() throws IOException {
   long start = System.currentTimeMillis();
   // doDirectory(TestAll.testdataDir + "radar/nexrad/level2/VCP11", false);
   // DiskCache.setCachePolicy( true);
   // DiskCache.setRootDirectory( System.getProperty( "java.io.tmpdir" ) + "/cache/");
   doDirectory(topDir + "nexrad/level2/", false, 10, ".raw");
   long took = System.currentTimeMillis() - start;
   System.out.println("that took = " + took + " msec");
 }
 /**
  * Delays, via Thread.sleep, for the given millisecond delay, but if the sleep is shorter than
  * specified, may re-sleep or yield until time elapses.
  */
 static void delay(long millis) throws InterruptedException {
   long startTime = System.nanoTime();
   long ns = millis * 1000 * 1000;
   for (; ; ) {
     if (millis > 0L) Thread.sleep(millis);
     else // too short to sleep
     Thread.yield();
     long d = ns - (System.nanoTime() - startTime);
     if (d > 0L) millis = d / (1000 * 1000);
     else break;
   }
 }
  /** Runs all JSR166 unit tests using junit.textui.TestRunner */
  public static void main(String[] args) {

    int iters = 1;
    if (args.length > 0) iters = Integer.parseInt(args[0]);
    Test s = suite();
    for (int i = 0; i < iters; ++i) {
      junit.textui.TestRunner.run(s);
      System.gc();
      System.runFinalization();
    }

    System.exit(0);
  }
 public void testBig() throws NoConvergenceException {
   for (int k = 0; k < Abig.length; ++k) {
     Abig[k][k] = 0.1;
     Bbig[k] = k;
   }
   for (int k = 0; k < Abig.length; ++k) {
     for (int l = 0; l < Abig.length; ++l) {
       Abig[k][l] += k * l / 1000.0;
     }
   }
   for (int k = 0; k < Abig.length; ++k) {
     for (int l = 0; l < Abig.length; ++l) {
       Abig[k][l] += (k % 3) * (l % 3) / 10.0;
     }
   }
   long before, after;
   before = System.currentTimeMillis();
   Minres.solve(Abig, Bbig);
   after = System.currentTimeMillis();
   System.out.println("Minres took " + (after - before) / 1000.0 + " seconds");
   before = System.currentTimeMillis();
   SymmLQ.solve(Abig, Bbig);
   after = System.currentTimeMillis();
   System.out.println("Symmlq took " + (after - before) / 1000.0 + " seconds");
   before = System.currentTimeMillis();
   ConjugateGradient.solve(Abig, Bbig);
   after = System.currentTimeMillis();
   System.out.println("ConjugateGradient took " + (after - before) / 1000.0 + " seconds");
   before = System.currentTimeMillis();
   JSciSolver.solve(Abig, Bbig);
   after = System.currentTimeMillis();
   System.out.println("LU Decomposition took " + (after - before) / 1000.0 + " seconds");
 }
  static {
    long time = System.currentTimeMillis();
    ISubgraphTemplate graph = GoogleGraphLoader.constructGoogleGraph();
    System.out.println("graph load: " + (System.currentTimeMillis() - time) / 1000.0);

    time = System.currentTimeMillis();
    _partition =
        new BasePartition(
            1,
            graph,
            PropertySet.EmptyPropertySet,
            PropertySet.EmptyPropertySet,
            Long2IntMaps.EMPTY_MAP,
            new TestSubgraphFactory());
    System.out.println("graph partitioning: " + (System.currentTimeMillis() - time) / 1000.0);
  }
  /** Runs all JSR166 unit tests using junit.textui.TestRunner */
  public static void main(String[] args) {
    if (useSecurityManager) {
      System.err.println("Setting a permissive security manager");
      Policy.setPolicy(permissivePolicy());
      System.setSecurityManager(new SecurityManager());
    }
    int iters = (args.length == 0) ? 1 : Integer.parseInt(args[0]);

    Test s = suite();
    for (int i = 0; i < iters; ++i) {
      junit.textui.TestRunner.run(s);
      System.gc();
      System.runFinalization();
    }
    System.exit(0);
  }
  public void testAny() {

    try {
      String ddl =
          "drop table PRICE_RELATE_USER_ORDER_V2 if exists;"
              + "create table PRICE_RELATE_USER_ORDER_V2 "
              + "(ID_ORDER_V2 BIGINT, ID_USER NUMERIC, DATE_CREATE TIMESTAMP)";
      String sql =
          "insert into PRICE_RELATE_USER_ORDER_V2 "
              + "(ID_ORDER_V2, ID_USER, DATE_CREATE) "
              + "values "
              + "(?, ?, ?)";
      Statement st = connection.createStatement();

      st.execute(ddl);

      PreparedStatement ps = connection.prepareStatement(sql);

      ps.setLong(1, 1);
      ps.setNull(2, Types.NUMERIC);
      ps.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
      ps.execute();
    } catch (SQLException e) {
      e.printStackTrace();
      System.out.println("TestSql.testAny() error: " + e.getMessage());
    }

    System.out.println("testAny complete");
  }
 /**
  * Construct with invalid System property for JGAPFactory set.
  *
  * @author Klaus Meffert
  * @since 2.6
  */
 public void testConstruct_1() {
   System.setProperty(Configuration.PROPERTY_JGAPFACTORY_CLASS, "org.jgap.myFactoryTest");
   try {
     new Configuration();
     fail();
   } catch (RuntimeException rex) {; // this is OK
   }
 }
 /**
  * Test supported Supergene features, including performance tests. previously: return true if the
  * Supergene tests succeded
  *
  * @throws Exception
  */
 public void testSupergeneTotal() throws Exception {
   System.out.println("Testing Supergene...");
   AbstractSupergeneTest.EXISTING_SOLUTIONS_ONLY = true;
   AbstractSupergeneTest.REPORT_ENABLED = false;
   Force.REPORT_ENABLED = false;
   System.out.println("Testing Persistent representation");
   //      assertTrue("Persistent representation",
   //          SupergenePersistentRepresentationTest.testRepresentation());
   System.out.println("Testing Supergene 150 % performance benefit ");
   AbstractSupergeneTest.MAX_ALLOWED_EVOLUTIONS = 512;
   AbstractSupergeneTest.POPULATION_SIZE = 256;
   long abe = 0;
   int N = 12;
   for (int i = 1; i <= N; i++) {
     System.out.println("Iteration " + i + " of " + N);
     AbstractSupergene.reset();
     long s_started;
     // Test with Supergene
     System.out.print("            evaluating Supergene... ");
     s_started = System.currentTimeMillis();
     int E_s = new SupergeneSample().test();
     long d_supergene = System.currentTimeMillis() - s_started;
     // Test without Supergene
     System.out.println("control...");
     s_started = System.currentTimeMillis();
     int E_w = new WithoutSupergeneSample().test();
     long d_without = System.currentTimeMillis() - s_started;
     assertTrue(
         "Correctness of solution: supergene " + E_s + " control " + E_w, E_s == 0 && E_w == 0);
     long benefit = (100 * d_without) / d_supergene;
     assertTrue(
         "Computation speed: supergene "
             + d_supergene
             + " control "
             + d_without
             + ", benefit "
             + benefit,
         true);
     abe += benefit;
   }
   abe = abe / N;
   assertTrue("Averaged benefit " + abe, abe >= 150);
   System.out.println("Supergene test complete.");
   //      return true;
 }
 /** Spin-waits until sync.isQueued(t) becomes true. */
 void waitForQueuedThread(AbstractQueuedLongSynchronizer sync, Thread t) {
   long startTime = System.nanoTime();
   while (!sync.isQueued(t)) {
     if (millisElapsedSince(startTime) > LONG_DELAY_MS)
       throw new AssertionFailedError("timed out");
     Thread.yield();
   }
   assertTrue(t.isAlive());
 }
 /** Return if the data-source is JTA or not. */
 public static boolean isJTA() {
   String property = System.getProperty("is.JTA");
   if (property != null && property.toUpperCase().equals("FALSE")) {
     isJTA = false;
   } else {
     isJTA = true;
   }
   return isJTA;
 }
 /** Return if the test is running on a JEE server, or in JSE. */
 public static boolean isOnServer() {
   if (isOnServer == null) {
     if (System.getProperty("TEST_SERVER_PLATFORM") != null) {
       isOnServer = true;
     } else {
       isOnServer = false;
     }
   }
   return isOnServer;
 }
Example #20
0
  /**
   * Returns all properties necessary for the intialization of the account with
   * <tt>accountPrefix</tt>.
   *
   * @param accountPrefix the prefix contained by all property names for the the account we'd like
   *     to initialized
   * @return a Hashtable that can be used when creating the account in a protocol provider factory.
   */
  private Hashtable<String, String> getAccountProperties(String accountPrefix) {
    Hashtable<String, String> table = new Hashtable<String, String>();

    String userID = System.getProperty(accountPrefix + ProtocolProviderFactory.USER_ID, null);

    assertNotNull(
        "The system property named "
            + accountPrefix
            + ProtocolProviderFactory.USER_ID
            + " has to tontain a valid Jabber address that could be used during "
            + "SIP Communicator's tests.",
        userID);

    table.put(ProtocolProviderFactory.USER_ID, userID);

    String passwd = System.getProperty(accountPrefix + ProtocolProviderFactory.PASSWORD, null);

    assertNotNull(
        "The system property named "
            + accountPrefix
            + ProtocolProviderFactory.PASSWORD
            + " has to contain the password corresponding to the account "
            + "specified in "
            + accountPrefix
            + ProtocolProviderFactory.USER_ID,
        passwd);

    table.put(ProtocolProviderFactory.PASSWORD, passwd);

    String serverAddress =
        System.getProperty(accountPrefix + ProtocolProviderFactory.SERVER_ADDRESS, null);

    // optional
    if (serverAddress != null) table.put(ProtocolProviderFactory.SERVER_ADDRESS, serverAddress);

    String serverPort =
        System.getProperty(accountPrefix + ProtocolProviderFactory.SERVER_PORT, null);

    // optional
    if (serverPort != null) table.put(ProtocolProviderFactory.SERVER_PORT, serverPort);

    return table;
  }
 /** Return if the test should run on the server. */
 public boolean shouldRunTestOnServer() {
   if (shouldRunTestOnServer == null) {
     String property = System.getProperty(RUN_ON_SERVER);
     if (property != null) {
       shouldRunTestOnServer = property.toUpperCase().equals("TRUE");
     } else {
       shouldRunTestOnServer = false;
     }
   }
   return shouldRunTestOnServer;
 }
 public void testStopsWhenQueryBetterThanElapsed() throws Exception {
   System.gc();
   BestQueryExplainer bq = new BestQueryExplainer();
   bq.add(q1); // Takes 600 milliseconds
   Thread.sleep(700);
   try {
     bq.add(q2);
     fail("Expected: BestQueryException");
   } catch (BestQueryException e) {
   }
 }
Example #23
0
  public void testFromTo() {
    System.out.println("FromTo");

    long t_start, t_end;
    float t_work;
    t_start = System.currentTimeMillis();

    String text = "text";
    for (int i = 0; i < 300000; i++) {
      String encode_from = "UTF8";
      String encode_to = "ISO8859_1";
      text = Encodings.FromTo(text, encode_from, encode_to);
      text = Encodings.FromTo(text, encode_to, encode_from);
    }

    t_end = System.currentTimeMillis();
    t_work = (t_end - t_start) / 1000f; // in sec

    System.out.println("FromTo() total time: " + t_work + "sec.");
  }
  public void testReturnBest() throws Exception {
    System.gc();
    BestQueryExplainer bq = new BestQueryExplainer();
    bq.add(q1);
    bq.add(q2);
    assertEquals(q1, bq.getBestQuery());

    bq = new BestQueryExplainer();
    bq.add(q2);
    bq.add(q1);
    assertEquals(q1, bq.getBestQuery());
  }
 protected void runTestProfiled() throws Throwable {
   // Warmup run, notably to trigger all needed classloading.
   super.runTest();
   long t0 = System.nanoTime();
   try {
     super.runTest();
   } finally {
     long elapsedMillis = millisElapsedSince(t0);
     if (elapsedMillis >= profileThreshold)
       System.out.printf("%n%s: %d%n", toString(), elapsedMillis);
   }
 }
Example #26
0
 protected void setUp() {
   try {
     new MySQLDB();
     SQLDB.startDatabase();
     SQLDB.registerDatabase();
     SQLDB.cleanDatabase();
   } catch (Exception e) {
     e.printStackTrace();
     System.exit(-1);
   }
   PlanWorksTest.TEST_RUNNING = 2;
 }
Example #27
0
  private void beforeFirstTest() {
    if ((ourMode & START_GUARD) != 0) {
      Thread timeAndMemoryGuard =
          new Thread() {
            @Override
            public void run() {
              log("Starting Time and Memory Guard");
              while (true) {
                try {
                  try {
                    Thread.sleep(10000);
                  } catch (InterruptedException e) {
                    e.printStackTrace();
                  }
                  // check for time spent on current test
                  if (myLastTestStartTime != 0) {
                    long currTime = System.currentTimeMillis();
                    long secondsSpent = (currTime - myLastTestStartTime) / 1000L;
                    Thread currentThread = getCurrentThread();
                    if (!mySavingMemorySnapshot) {
                      if (secondsSpent > PlatformTestCase.ourTestTime * myLastTestTestMethodCount) {
                        UsefulTestCase.printThreadDump();
                        log(
                            "Interrupting current Test (out of time)! Test class: "
                                + myLastTestClass
                                + " Seconds spent = "
                                + secondsSpent);
                        myInterruptedByOutOfTime = true;
                        if (currentThread != null) {
                          currentThread.interrupt();
                          if (!currentThread.isInterrupted()) {
                            //noinspection deprecation
                            currentThread.stop(
                                new RuntimeException("Current Test Interrupted: OUT OF TIME!"));
                          }

                          break;
                        }
                      }
                    }
                  }
                } catch (Exception e) {
                  e.printStackTrace();
                }
              }
              log("Time and Memory Guard finished.");
            }
          };
      timeAndMemoryGuard.setDaemon(true);
      timeAndMemoryGuard.start();
    }
    myStartTime = System.currentTimeMillis();
  }
  private void createFiles() {
    try {
      tmpFile = File.createTempFile("thredds.testLogicalCompFilterFactory", "file");
    } catch (IOException e) {
      assertTrue("Failed to create temp file in default temp directory: " + e.getMessage(), false);
      return;
    }

    tmpDir = new File(tmpFile.getParentFile(), "thredds.testLogicalCompFilterFactory");

    file1 = new File(tmpDir, "new.grib1");
    file2 = new File(tmpDir, "old.grib1");
    file3 = new File(tmpDir, "new.nc");
    file4 = new File(tmpDir, "old.nc");

    if (!tmpDir.mkdir()) {
      assertTrue("Failed to create test dir <" + tmpDir.getAbsolutePath() + ">.", false);
      return;
    }
    try {
      file1.createNewFile();
      file2.createNewFile();
      file3.createNewFile();
      file4.createNewFile();
    } catch (IOException e) {
      assertTrue("Failed to create test file: " + e.getMessage(), false);
      return;
    }

    if (!file2.setLastModified(System.currentTimeMillis() - 360000)) {
      assertTrue("Failed to set last modified time <" + file2.getPath() + ">.", false);
      deleteFiles();
      return;
    }
    if (!file4.setLastModified(System.currentTimeMillis() - 360000)) {
      assertTrue("Failed to set last modified time <" + file4.getPath() + ">.", false);
      deleteFiles();
      return;
    }
  }
 /** Checks that future.get times out, with the given millisecond timeout. */
 void assertFutureTimesOut(Future future, long timeoutMillis) {
   long startTime = System.nanoTime();
   try {
     future.get(timeoutMillis, MILLISECONDS);
     shouldThrow();
   } catch (TimeoutException success) {
   } catch (Exception e) {
     threadUnexpectedException(e);
   } finally {
     future.cancel(true);
   }
   assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
 }
 /**
  * Spin-waits up to the specified number of milliseconds for the given thread to enter a wait
  * state: BLOCKED, WAITING, or TIMED_WAITING.
  */
 void waitForThreadToEnterWaitState(Thread thread, long timeoutMillis) {
   long startTime = System.nanoTime();
   for (; ; ) {
     Thread.State s = thread.getState();
     if (s == Thread.State.BLOCKED || s == Thread.State.WAITING || s == Thread.State.TIMED_WAITING)
       return;
     else if (s == Thread.State.TERMINATED) fail("Unexpected thread termination");
     else if (millisElapsedSince(startTime) > timeoutMillis) {
       threadAssertTrue(thread.isAlive());
       return;
     }
     Thread.yield();
   }
 }