equal
deleted
inserted
replaced
25 import java.util.concurrent.TimeUnit; |
25 import java.util.concurrent.TimeUnit; |
26 import java.util.concurrent.TimeoutException; |
26 import java.util.concurrent.TimeoutException; |
27 import java.util.concurrent.atomic.AtomicInteger; |
27 import java.util.concurrent.atomic.AtomicInteger; |
28 import java.util.concurrent.locks.LockSupport; |
28 import java.util.concurrent.locks.LockSupport; |
29 |
29 |
30 import jdk.testlibrary.LockFreeLogManager; |
30 import jdk.test.lib.LockFreeLogger; |
31 import jdk.testlibrary.Utils; |
31 import jdk.testlibrary.Utils; |
32 |
32 |
33 /** |
33 /** |
34 * ThreadStateController allows a thread to request this thread to transition |
34 * ThreadStateController allows a thread to request this thread to transition |
35 * to a specific thread state. The {@linkplain #transitionTo request} is |
35 * to a specific thread state. The {@linkplain #transitionTo request} is |
98 |
98 |
99 // for debugging |
99 // for debugging |
100 private final AtomicInteger iterations = new AtomicInteger(); |
100 private final AtomicInteger iterations = new AtomicInteger(); |
101 private final AtomicInteger interrupted = new AtomicInteger(); |
101 private final AtomicInteger interrupted = new AtomicInteger(); |
102 |
102 |
103 private final LockFreeLogManager logManager = new LockFreeLogManager(); |
103 private final LockFreeLogger logger = new LockFreeLogger(); |
104 |
104 |
105 @Override |
105 @Override |
106 public void run() { |
106 public void run() { |
107 // this thread has started |
107 // this thread has started |
108 while (!done) { |
108 while (!done) { |
347 return "unknown " + state; |
347 return "unknown " + state; |
348 } |
348 } |
349 } |
349 } |
350 |
350 |
351 private void log(String msg, Object ... params) { |
351 private void log(String msg, Object ... params) { |
352 logManager.log(msg, params); |
352 logger.log(msg, params); |
353 } |
353 } |
354 |
354 |
355 /** |
355 /** |
356 * Waits for the controller to complete the test run and returns the |
356 * Waits for the controller to complete the test run and returns the |
357 * generated log |
357 * generated log |
359 * @throws InterruptedException |
359 * @throws InterruptedException |
360 */ |
360 */ |
361 public String getLog() throws InterruptedException { |
361 public String getLog() throws InterruptedException { |
362 this.join(); |
362 this.join(); |
363 |
363 |
364 return logManager.toString(); |
364 return logger.toString(); |
365 } |
365 } |
366 } |
366 } |