7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 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 24 import org.testng.annotations.Test; 25 import org.testng.Assert; 26 27 import jdk.test.lib.OutputAnalyzer; 28 29 import jdk.test.lib.dcmd.CommandExecutor; 30 import jdk.test.lib.dcmd.JMXExecutor; 31 32 import java.util.concurrent.BrokenBarrierException; 33 import java.util.concurrent.CyclicBarrier; 34 import java.util.concurrent.locks.ReentrantLock; 35 import java.util.regex.Pattern; 36 37 /* 38 * @test 39 * @summary Test of diagnostic command Thread.print 40 * @library /testlibrary 41 * @modules java.base/jdk.internal.misc 42 * java.compiler 43 * java.management 44 * jdk.jvmstat/sun.jvmstat.monitor 45 * @build jdk.test.lib.* 46 * @build jdk.test.lib.dcmd.* 47 * @run testng PrintTest 48 */ 49 public class PrintTest { 50 protected boolean jucLocks = false; 51 52 CyclicBarrier readyBarrier = new CyclicBarrier(3); 53 CyclicBarrier doneBarrier = new CyclicBarrier(3); 54 55 private void waitForBarrier(CyclicBarrier b) { 56 try { 57 b.await(); 58 } catch (InterruptedException | BrokenBarrierException e) { 59 Assert.fail("Test error: Caught unexpected exception:", e); 60 } 61 } 62 63 class MonitorThread extends Thread { 64 Object lock = new Object(); 65 66 public void run() { | 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 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 24 import org.testng.annotations.Test; 25 import org.testng.Assert; 26 27 import jdk.test.lib.process.OutputAnalyzer; 28 29 import jdk.test.lib.dcmd.CommandExecutor; 30 import jdk.test.lib.dcmd.JMXExecutor; 31 32 import java.util.concurrent.BrokenBarrierException; 33 import java.util.concurrent.CyclicBarrier; 34 import java.util.concurrent.locks.ReentrantLock; 35 import java.util.regex.Pattern; 36 37 /* 38 * @test 39 * @summary Test of diagnostic command Thread.print 40 * @library /test/lib 41 * @modules java.base/jdk.internal.misc 42 * java.compiler 43 * java.management 44 * jdk.jvmstat/sun.jvmstat.monitor 45 * @run testng PrintTest 46 */ 47 public class PrintTest { 48 protected boolean jucLocks = false; 49 50 CyclicBarrier readyBarrier = new CyclicBarrier(3); 51 CyclicBarrier doneBarrier = new CyclicBarrier(3); 52 53 private void waitForBarrier(CyclicBarrier b) { 54 try { 55 b.await(); 56 } catch (InterruptedException | BrokenBarrierException e) { 57 Assert.fail("Test error: Caught unexpected exception:", e); 58 } 59 } 60 61 class MonitorThread extends Thread { 62 Object lock = new Object(); 63 64 public void run() { |