Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001a.java
41160 views
1
/*
2
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
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
package nsk.jdi.BScenarios.multithrd;
25
26
import nsk.share.*;
27
import nsk.share.jpda.*;
28
import nsk.share.jdi.*;
29
30
// THIS TEST IS LINE NUMBER SENSITIVE
31
32
/**
33
* <code>tc01x001a</code> is deugee's part of the tc01x001.
34
*/
35
public class tc01x001a {
36
37
public final static String brkpMethodName = "bar";
38
public final static int brkpLineNumber = 89;
39
40
public final static int checkBrkpLine = 89;
41
public final static int checkStepLine = 90;
42
public final static int threadCount = 3;
43
private static Log log;
44
45
Thready [] thrds = new Thready [threadCount];
46
47
public static void main (String argv[]) {
48
ArgumentHandler argHandler = new ArgumentHandler(argv);
49
log = new Log(System.err, argHandler);
50
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
51
pipe.println(tc01x001.SGL_READY);
52
53
tc01x001a obj = null;
54
String instr;
55
do {
56
instr = pipe.readln();
57
if (instr.equals(tc01x001.SGL_PERFORM)) {
58
obj = new tc01x001a();
59
} else if (instr.equals(tc01x001.SGL_QUIT)) {
60
log.display(instr);
61
break;
62
} else {
63
log.complain("DEBUGEE> unexpected signal of debugger.");
64
System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE);
65
}
66
} while (true);
67
try {
68
for (int i = 0; i < obj.thrds.length; i++ ) {
69
obj.thrds[i].join();
70
}
71
} catch (InterruptedException e) {
72
}
73
log.display("completed succesfully.");
74
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
75
}
76
77
tc01x001a() {
78
for (int i = 0; i < thrds.length; i++ ) {
79
thrds[i] = new Thready("Thread-" + (i+1));
80
thrds[i].start();
81
}
82
}
83
84
public static void foo(String caller) {
85
log.display(caller + "::foo is called");
86
}
87
88
public static void bar(String caller) {
89
log.display(caller + "::bar is called"); // brkpLineNumber // checkBrkpLine
90
log.display(caller + "::bar_step"); // checkStepLine
91
}
92
93
static class Thready extends Thread {
94
Thready(String name) {
95
super(name);
96
}
97
98
public void run() {
99
tc01x001a.foo(getName());
100
tc01x001a.bar(getName());
101
}
102
}
103
}
104
105