author | jlahoda |
Wed, 27 Nov 2019 09:00:01 +0100 | |
changeset 59285 | 7799a51dbe30 |
parent 50154 | d2d6bc39ea88 |
permissions | -rw-r--r-- |
50154
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
1 |
/* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
4 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
8 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
13 |
* accompanied this code). |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
14 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
18 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
21 |
* questions. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
22 |
*/ |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
23 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
24 |
package nsk.sysdict.share; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
25 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
26 |
import java.io.File; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
27 |
import java.net.MalformedURLException; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
28 |
import java.net.URL; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
29 |
import java.net.URLClassLoader; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
30 |
import java.util.ArrayList; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
31 |
import java.util.Arrays; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
32 |
import java.util.List; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
33 |
import java.util.Random; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
34 |
import nsk.share.ClassUnloader; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
35 |
import nsk.share.TestFailure; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
36 |
import nsk.share.gc.ThreadedGCTest; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
37 |
import nsk.share.gc.gp.GarbageUtils; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
38 |
import nsk.share.test.ExecutionController; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
39 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
40 |
/** |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
41 |
* This is the base class for btree & chain tests. It is a standard GCThreaded Test. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
42 |
*/ |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
43 |
public abstract class SysDictTest extends ThreadedGCTest { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
44 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
45 |
static String PACKAGE_PREFIX = "nsk.sysdict.share."; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
46 |
// Should we additionally use ClassUnloader.unload to stress GC |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
47 |
private boolean isHeapStressed = false; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
48 |
// Should we use one JarLoader or a lot of them |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
49 |
private boolean useSingleLoader = true; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
50 |
// Should we use fats.jar with little amount large classes or not |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
51 |
boolean useFats = false; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
52 |
URL[] jars; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
53 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
54 |
protected void parseArgs(String args[]) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
55 |
for (int i = 0; i < args.length; i++) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
56 |
if (args[i].equals("-stressHeap")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
57 |
isHeapStressed = true; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
58 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
59 |
if (args[i].equals("-useFatClass")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
60 |
useFats = true; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
61 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
62 |
if (args[i].equals("-useSingleLoader")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
63 |
this.useSingleLoader = false; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
64 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
65 |
// jar path is in useal classpath format |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
66 |
if (args[i].equals("-jarpath")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
67 |
String[] files = args[i + 1].split(File.pathSeparator); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
68 |
jars = new URL[files.length]; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
69 |
for (int j = 0; j < files.length; j++) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
70 |
try { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
71 |
jars[j] = new File(files[j]).toURI().toURL(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
72 |
} catch (MalformedURLException e) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
73 |
throw new TestFailure(e); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
74 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
75 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
76 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
77 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
78 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
79 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
80 |
// each time we create a new classloader |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
81 |
protected ClassLoader createJarLoader() { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
82 |
return new URLClassLoader(jars); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
83 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
84 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
85 |
// The btree and chain tests differs by loaders and classes |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
86 |
// let define them in subclasses |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
87 |
abstract ClassLoader[] createLoaders(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
88 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
89 |
abstract String[] getClassNames(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
90 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
91 |
ClassLoader[] createClassLoadersInternal() { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
92 |
if (!useSingleLoader) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
93 |
return createLoaders(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
94 |
} else { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
95 |
ClassLoader[] single = new ClassLoader[1]; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
96 |
single[0] = createJarLoader(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
97 |
return single; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
98 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
99 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
100 |
volatile ClassLoader[] currentClassLoaders; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
101 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
102 |
class Worker implements Runnable { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
103 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
104 |
private ClassLoader loader; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
105 |
private String[] names; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
106 |
private ExecutionController stresser; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
107 |
int index; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
108 |
public String tmp; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
109 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
110 |
public Worker(int number, String[] classnames) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
111 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
112 |
this.index = number; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
113 |
this.names = new String[classnames.length]; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
114 |
List<String> listNames = new ArrayList<String>(classnames.length); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
115 |
listNames.addAll(Arrays.asList(classnames)); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
116 |
for (int i = 0; i < classnames.length; i++) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
117 |
int idx1 = new Random().nextInt(listNames.size()); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
118 |
this.names[i] = listNames.remove(idx1); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
119 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
120 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
121 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
122 |
@Override |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
123 |
public void run() { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
124 |
if (stresser == null) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
125 |
stresser = getExecutionController(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
126 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
127 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
128 |
// only first thread update all classloaders |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
129 |
// do not care about synchronization |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
130 |
if (index == 0) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
131 |
try { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
132 |
currentClassLoaders = createClassLoadersInternal(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
133 |
} catch (OutOfMemoryError oome) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
134 |
// skip iterations until all loaders will be unloaded |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
135 |
Thread.yield(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
136 |
return; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
137 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
138 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
139 |
for (int i = 0; i < names.length; i++) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
140 |
try { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
141 |
String name = names[i]; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
142 |
if (!stresser.continueExecution()) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
143 |
return; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
144 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
145 |
// just check if loader was updated |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
146 |
loader = currentClassLoaders[index]; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
147 |
Class clz = Class.forName(name, true, loader); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
148 |
// set name into public variable just to be sure |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
149 |
// that class is loaded |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
150 |
tmp = clz.getName(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
151 |
} catch (ClassNotFoundException cnfe) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
152 |
throw new TestFailure(cnfe); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
153 |
} catch (OutOfMemoryError oome) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
154 |
// just ignore |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
155 |
// we do not check memory leaks in PermGen in this tests |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
156 |
} catch (StackOverflowError soe) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
157 |
// just ignore, chains could be too large |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
158 |
// StackOverflowError could be in some sparcs |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
159 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
160 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
161 |
if (isHeapStressed) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
162 |
GarbageUtils.eatMemory(stresser, 50, 1024, 0); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
163 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
164 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
165 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
166 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
167 |
@Override |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
168 |
protected Runnable createRunnable(int i) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
169 |
currentClassLoaders = createClassLoadersInternal(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
170 |
return new Worker(i % currentClassLoaders.length, getClassNames()); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
171 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
172 |
} |