< prev index next >

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

Print this page

 25 
 26 import java.lang.management.*;
 27 import nsk.share.log.*;
 28 import java.util.Map;
 29 import java.util.HashMap;
 30 import java.util.concurrent.locks.ReentrantLock;
 31 import java.util.concurrent.locks.Condition;
 32 import java.util.concurrent.locks.Lock;
 33 
 34 /**
 35  * Scenario that starts two threads that use locks * to synchronize.
 36  * The code is based on tests/java/lang/management/ThreadMXBean/LockingThread.java
 37  */
 38 public class SynchronizerLockingThreads implements ThreadMonitoringScenario, LogAware {
 39         private static final String[] expectedMethodsThread1 = {
 40                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.runInside",
 41                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.A",
 42                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.B",
 43                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.C",
 44                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.D",
 45                 "java.lang.Object.wait"

 46         };
 47         private static final String[] expectedMethodsThread2 = {
 48                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread2.runInside"
 49         };
 50         private ReentrantLock lock1 = new ReentrantLock();
 51         private ReentrantLock lock2 = new ReentrantLock();
 52         private ReentrantLock lock3 = new ReentrantLock();
 53         private ReentrantLock lock4 = new ReentrantLock();
 54         private CustomLock lock5 = new CustomLock("lock5");
 55         private CustomLock lock6 = new CustomLock("lock6");
 56         private CustomLock lock7 = new CustomLock("lock7");
 57         private ReentrantLock lock8 = new ReentrantLock();
 58         private MonitoringThread thread1;
 59         private MonitoringThread thread2;
 60         private Log log;
 61         private RunType recursionType;
 62         private int maxDepth;
 63 
 64         public SynchronizerLockingThreads(Log log, RunType recursionType, int maxDepth) {
 65                 setLog(log);

 25 
 26 import java.lang.management.*;
 27 import nsk.share.log.*;
 28 import java.util.Map;
 29 import java.util.HashMap;
 30 import java.util.concurrent.locks.ReentrantLock;
 31 import java.util.concurrent.locks.Condition;
 32 import java.util.concurrent.locks.Lock;
 33 
 34 /**
 35  * Scenario that starts two threads that use locks * to synchronize.
 36  * The code is based on tests/java/lang/management/ThreadMXBean/LockingThread.java
 37  */
 38 public class SynchronizerLockingThreads implements ThreadMonitoringScenario, LogAware {
 39         private static final String[] expectedMethodsThread1 = {
 40                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.runInside",
 41                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.A",
 42                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.B",
 43                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.C",
 44                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.D",
 45                 "java.lang.Object.wait",
 46                 "java.lang.Object.wait0"
 47         };
 48         private static final String[] expectedMethodsThread2 = {
 49                 "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread2.runInside"
 50         };
 51         private ReentrantLock lock1 = new ReentrantLock();
 52         private ReentrantLock lock2 = new ReentrantLock();
 53         private ReentrantLock lock3 = new ReentrantLock();
 54         private ReentrantLock lock4 = new ReentrantLock();
 55         private CustomLock lock5 = new CustomLock("lock5");
 56         private CustomLock lock6 = new CustomLock("lock6");
 57         private CustomLock lock7 = new CustomLock("lock7");
 58         private ReentrantLock lock8 = new ReentrantLock();
 59         private MonitoringThread thread1;
 60         private MonitoringThread thread2;
 61         private Log log;
 62         private RunType recursionType;
 63         private int maxDepth;
 64 
 65         public SynchronizerLockingThreads(Log log, RunType recursionType, int maxDepth) {
 66                 setLog(log);
< prev index next >