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/tc02x003a.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>tc02x003a</code> is deugee's part of the tc02x003.
34
*/
35
public class tc02x003a {
36
37
public final static int threadCount = 3;
38
static Log log;
39
40
public final static int checkClassBrkpLine1 = 96;
41
public final static int checkClassBrkpLine2 = 98;
42
Thready [] thrds = new Thready [threadCount];
43
44
public static void main (String argv[]) {
45
ArgumentHandler argHandler = new ArgumentHandler(argv);
46
log = new Log(System.err, argHandler);
47
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
48
pipe.println(tc02x003.SGL_READY);
49
50
tc02x003a obj = null;
51
String instr;
52
do {
53
instr = pipe.readln();
54
if (instr.equals(tc02x003.SGL_LOAD)) {
55
tc02x003aClass1.loadThis = true;
56
obj = new tc02x003a();
57
} else if (instr.equals(tc02x003.SGL_QUIT)) {
58
log.display(instr);
59
break;
60
} else {
61
log.complain("DEBUGEE> unexpected signal of debugger.");
62
System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE);
63
}
64
} while (true);
65
try {
66
for (int i = 0; i < obj.thrds.length; i++ ) {
67
obj.thrds[i].join();
68
}
69
} catch (InterruptedException e) {
70
}
71
log.display("completed succesfully.");
72
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
73
}
74
75
tc02x003a() {
76
for (int i = 0; i < thrds.length; i++ ) {
77
thrds[i] = new Thready("Thread-" + (i+1));
78
thrds[i].start();
79
}
80
}
81
82
static class Thready extends Thread {
83
Thready(String name) {
84
super(name);
85
}
86
87
public void run() {
88
log.display(getName() + ":: creating tc02x003aClass1");
89
new tc02x003aClass1(getName());
90
}
91
}
92
}
93
94
class tc02x003aClass1 {
95
96
static boolean loadThis = false; // checkClassBrkpLine1
97
98
public tc02x003aClass1(String thrdName) { // checkClassBrkpLine2
99
tc02x003a.log.display("tc02x003aClass1::constructor is called from"
100
+ thrdName);
101
}
102
}
103
104