public void test() { for (int count = 0; count < numThreads; ++count) { ConcurrentTestRefreshWithOptimisticLocking.threadList[count].start(); } Thread checker = new Thread(new ConcurrentTestRefreshWithOptimisticLocking(true, -1).runnable()); checker.start(); try { checker.join(); } catch (InterruptedException ex) { throw new TestProblemException("Test thread was interrupted. Test failed to run properly"); } }
public void watchOtherThreads() { long startTime = System.currentTimeMillis(); while (((System.currentTimeMillis() - startTime) < (runTime + 30000)) && ConcurrentTestRefreshWithOptimisticLocking.execute) { for (int localIdex = 0; localIdex < numThreads; ++localIdex) { if ((System.currentTimeMillis() - ConcurrentTestRefreshWithOptimisticLocking.timeList[localIdex]) > 30000) { // System.out.println(" Number: " + localIdex + " time: " + (System.currentTimeMillis() - // this.timeList[localIdex])); execute = false; break; } } try { Thread.sleep(30000); } catch (InterruptedException ex) { throw new TestProblemException("Test thread was interrupted. Test failed to run properly"); } } }