author | jlahoda |
Wed, 12 Dec 2012 20:26:56 +0100 | |
changeset 14803 | 88347e495d34 |
parent 10046 | f80878957a13 |
child 14683 | 38921a46c62d |
permissions | -rw-r--r-- |
10046
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
1 |
/* |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
4 |
* |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
8 |
* |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
13 |
* accompanied this code). |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
14 |
* |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
18 |
* |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
21 |
* questions. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
22 |
*/ |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
23 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
24 |
/* |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
25 |
* @test |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
26 |
* @bug 7045594 |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
27 |
* @summary ResourceBundle setting race in Logger.getLogger(name, rbName) |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
28 |
* @author Daniel D. Daugherty |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
29 |
* @build RacingThreadsTest LoggerResourceBundleRace |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
30 |
* @run main LoggerResourceBundleRace |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
31 |
*/ |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
32 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
33 |
import java.util.concurrent.atomic.AtomicInteger; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
34 |
import java.util.ListResourceBundle; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
35 |
import java.util.logging.Logger; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
36 |
import java.util.MissingResourceException; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
37 |
import java.util.ResourceBundle; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
38 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
39 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
40 |
public class LoggerResourceBundleRace extends RacingThreadsTest { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
41 |
private final static int N_LOOPS = 500000; // # of race loops |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
42 |
private final static int N_SECS = 15; // # of secs to run test |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
43 |
// # of parallel threads; must match number of MyResources inner classes |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
44 |
private final static int N_THREADS = 3; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
45 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
46 |
private final static String LOGGER_PREFIX = "myLogger-"; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
47 |
private final static String RESOURCE_PREFIX |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
48 |
= "LoggerResourceBundleRace$MyResources"; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
49 |
// these counters are AtomicInteger since any worker thread can increment |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
50 |
private final static AtomicInteger iaeCnt = new AtomicInteger(); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
51 |
private final static AtomicInteger worksCnt = new AtomicInteger(); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
52 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
53 |
Logger dummy; // dummy Logger |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
54 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
55 |
LoggerResourceBundleRace(String name, int n_threads, int n_loops, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
56 |
int n_secs) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
57 |
super(name, n_threads, n_loops, n_secs); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
58 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
59 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
60 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
61 |
// Main test driver |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
62 |
// |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
63 |
public static void main(String[] args) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
64 |
LoggerResourceBundleRace test |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
65 |
= new LoggerResourceBundleRace("LoggerResourceBundleRace", |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
66 |
N_THREADS, N_LOOPS, N_SECS); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
67 |
test.setVerbose( |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
68 |
Boolean.getBoolean("LoggerResourceBundleRace.verbose")); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
69 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
70 |
DriverThread driver = new DriverThread(test); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
71 |
MyWorkerThread[] workers = new MyWorkerThread[N_THREADS]; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
72 |
for (int i = 0; i < workers.length; i++) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
73 |
workers[i] = new MyWorkerThread(i, test); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
74 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
75 |
test.runTest(driver, workers); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
76 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
77 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
78 |
public void oneTimeDriverInit(DriverThread dt) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
79 |
super.oneTimeDriverInit(dt); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
80 |
dummy = null; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
81 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
82 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
83 |
public void perRaceDriverInit(DriverThread dt) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
84 |
super.perRaceDriverInit(dt); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
85 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
86 |
// - allocate a new dummy Logger without a ResourceBundle; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
87 |
// this gives the racing threads less to do |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
88 |
// - reset the counters |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
89 |
dummy = Logger.getLogger(LOGGER_PREFIX + getLoopCnt()); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
90 |
iaeCnt.set(0); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
91 |
worksCnt.set(0); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
92 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
93 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
94 |
public void executeRace(WorkerThread wt) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
95 |
super.executeRace(wt); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
96 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
97 |
Logger myLogger = null; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
98 |
try { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
99 |
MyWorkerThread mwt = (MyWorkerThread) wt; // short hand |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
100 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
101 |
// Here is the race: |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
102 |
// - the target Logger object has already been created by |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
103 |
// the DriverThread without a ResourceBundle name |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
104 |
// - in parallel, each WorkerThread calls Logger.getLogger() |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
105 |
// with a different ResourceBundle name |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
106 |
// - Logger.getLogger() should only successfully set the |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
107 |
// ResourceBundle name for one WorkerThread; all other |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
108 |
// WorkerThread calls to Logger.getLogger() should throw |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
109 |
// IllegalArgumentException |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
110 |
myLogger = Logger.getLogger(LOGGER_PREFIX + getLoopCnt(), |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
111 |
mwt.rbName); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
112 |
if (myLogger.getResourceBundleName().equals(mwt.rbName)) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
113 |
// no exception and the ResourceBundle names match |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
114 |
worksCnt.incrementAndGet(); // ignore return |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
115 |
} else { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
116 |
System.err.println(wt.getName() |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
117 |
+ ": ERROR: expected ResourceBundleName '" |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
118 |
+ mwt.rbName + "' does not match actual '" |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
119 |
+ myLogger.getResourceBundleName() + "'"); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
120 |
incAndGetFailCnt(); // ignore return |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
121 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
122 |
} catch (IllegalArgumentException iae) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
123 |
iaeCnt.incrementAndGet(); // ignore return |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
124 |
} catch (MissingResourceException mre) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
125 |
// This exception happens when N_THREADS above does not |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
126 |
// match the number of MyResources inner classes below. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
127 |
// We exit since this is a coding error. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
128 |
unexpectedException(wt, mre); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
129 |
System.exit(2); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
130 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
131 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
132 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
133 |
public void checkRaceResults(DriverThread dt) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
134 |
super.checkRaceResults(dt); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
135 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
136 |
if (worksCnt.get() != 1) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
137 |
System.err.println(dt.getName() + ": ERROR: worksCnt should be 1" |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
138 |
+ ": loopCnt=" + getLoopCnt() + ", worksCnt=" + worksCnt.get()); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
139 |
incAndGetFailCnt(); // ignore return |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
140 |
} else if (iaeCnt.get() != N_THREADS - 1) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
141 |
System.err.println(dt.getName() + ": ERROR: iaeCnt should be " |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
142 |
+ (N_THREADS - 1) + ": loopCnt=" + getLoopCnt() |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
143 |
+ ", iaeCnt=" + iaeCnt.get()); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
144 |
incAndGetFailCnt(); // ignore return |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
145 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
146 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
147 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
148 |
public void oneTimeDriverEpilog(DriverThread dt) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
149 |
super.oneTimeDriverEpilog(dt); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
150 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
151 |
// Use the dummy Logger after the testing loop to make sure that |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
152 |
// dummy doesn't get optimized away in the testing loop. |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
153 |
dummy.info("This is a test message."); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
154 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
155 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
156 |
// N_THREADS above must match number of MyResources inner classes |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
157 |
// |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
158 |
public static class MyResources0 extends ListResourceBundle { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
159 |
final static Object[][] contents = { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
160 |
{"sample1", "translation #1 for sample1"}, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
161 |
{"sample2", "translation #1 for sample2"}, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
162 |
}; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
163 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
164 |
public Object[][] getContents() { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
165 |
return contents; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
166 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
167 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
168 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
169 |
public static class MyResources1 extends ListResourceBundle { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
170 |
final static Object[][] contents = { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
171 |
{"sample1", "translation #2 for sample1"}, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
172 |
{"sample2", "translation #2 for sample2"}, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
173 |
}; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
174 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
175 |
public Object[][] getContents() { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
176 |
return contents; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
177 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
178 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
179 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
180 |
public static class MyResources2 extends ListResourceBundle { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
181 |
final static Object[][] contents = { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
182 |
{"sample1", "translation #3 for sample1"}, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
183 |
{"sample2", "translation #3 for sample2"}, |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
184 |
}; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
185 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
186 |
public Object[][] getContents() { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
187 |
return contents; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
188 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
189 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
190 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
191 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
192 |
// WorkerThread with a thread specific ResourceBundle name |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
193 |
// |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
194 |
public static class MyWorkerThread extends WorkerThread { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
195 |
public final String rbName; // ResourceBundle name |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
196 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
197 |
MyWorkerThread(int workerNum, RacingThreadsTest test) { |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
198 |
super(workerNum, test); |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
199 |
|
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
200 |
rbName = RESOURCE_PREFIX + workerNum; |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
201 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
202 |
} |
f80878957a13
7045594: 4/4 fix for 6977677 introduced a ResourceBundle race
dcubed
parents:
diff
changeset
|
203 |
} |