< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RunningThread.java

Print this page

19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 package nsk.monitoring.share.thread;
24 
25 import nsk.share.log.Log;
26 import java.lang.management.ThreadInfo;
27 import nsk.share.TestFailure;
28 
29 /**
30  * RunningThread is a RecursiveMonitoringThread that simply
31  * runs a loop.
32  */
33 public class RunningThread extends RecursiveMonitoringThread {
34         private volatile boolean running = false;
35         private volatile boolean ready = false;
36         private Object readyLock = new Object();
37         private static final String[] expectedMethods = {
38                 "nsk.monitoring.share.thread.RunningThread.runInside",
39                 "java.lang.Thread.yield"

40         };
41 
42         public RunningThread(Log log, RunType recursionType, int maxDepth) {
43                 super(log, recursionType, maxDepth);
44         }
45 
46         public void waitState() {
47                 synchronized (readyLock) {
48                         while (!ready) {
49                                 try {
50                                         readyLock.wait();
51                                 } catch (InterruptedException e) {
52                                         log.warn(e);
53                                 }
54                         }
55                 }
56                 waitThreadState(Thread.State.RUNNABLE);
57         }
58 
59         public void finish() {

19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 package nsk.monitoring.share.thread;
24 
25 import nsk.share.log.Log;
26 import java.lang.management.ThreadInfo;
27 import nsk.share.TestFailure;
28 
29 /**
30  * RunningThread is a RecursiveMonitoringThread that simply
31  * runs a loop.
32  */
33 public class RunningThread extends RecursiveMonitoringThread {
34         private volatile boolean running = false;
35         private volatile boolean ready = false;
36         private Object readyLock = new Object();
37         private static final String[] expectedMethods = {
38                 "nsk.monitoring.share.thread.RunningThread.runInside",
39                 "java.lang.Thread.yield",
40                 "java.lang.Thread.yield0"
41         };
42 
43         public RunningThread(Log log, RunType recursionType, int maxDepth) {
44                 super(log, recursionType, maxDepth);
45         }
46 
47         public void waitState() {
48                 synchronized (readyLock) {
49                         while (!ready) {
50                                 try {
51                                         readyLock.wait();
52                                 } catch (InterruptedException e) {
53                                         log.warn(e);
54                                 }
55                         }
56                 }
57                 waitThreadState(Thread.State.RUNNABLE);
58         }
59 
60         public void finish() {
< prev index next >