blob: 09b733d4b04a6b4102d81989b00b74693ccbf2bf [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001/*
ohair2283b9d2010-05-25 15:58:33 -07002 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
duke6e45e102007-12-01 00:00:00 +00003 * 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 *
ohair2283b9d2010-05-25 15:58:33 -070019 * 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.
duke6e45e102007-12-01 00:00:00 +000022 */
23/*
24 @test
25 @summary test Resource Bundle for bug 4168625
26 @build Bug4168625Class Bug4168625Getter Bug4168625Resource Bug4168625Resource3 Bug4168625Resource3_en Bug4168625Resource3_en_CA Bug4168625Resource3_en_IE Bug4168625Resource3_en_US Bug4168625Resource2_en_US Bug4168625Resource2
27 @run main/timeout=600 Bug4168625Test
naoto2071ff62010-10-22 11:32:26 -070028 @bug 4168625 6993339
duke6e45e102007-12-01 00:00:00 +000029*/
30/*
31 *
32 *
33 * (C) Copyright IBM Corp. 1999 - All Rights Reserved
34 *
duke6e45e102007-12-01 00:00:00 +000035 * This software is the confidential and proprietary information
36 * of Sun Microsystems, Inc. ("Confidential Information"). You
37 * shall not disclose such Confidential Information and shall use
38 * it only in accordance with the terms of the license agreement
39 * you entered into with Sun.
40 *
41 * The original version of this source code and documentation is
42 * copyrighted and owned by IBM. These materials are provided
43 * under terms of a License Agreement between IBM and Sun.
44 * This technology is protected by multiple US and International
45 * patents. This notice and attribution to IBM may not be removed.
46 *
47 */
48
49import java.util.*;
50import java.io.*;
51
52/**
naoto2071ff62010-10-22 11:32:26 -070053 * This test tries to correct two efficiency problems with the caching
54 * mechanism of ResourceBundle. It also allows concurrent loads
duke6e45e102007-12-01 00:00:00 +000055 * of resource bundles to be performed if the bundles are unrelated (ex. a
56 * load of a local system resource by one thread while another thread is
57 * doing a slow load over a network).
58 */
59public class Bug4168625Test extends RBTestFmwk {
60 public static void main(String[] args) throws Exception {
61 new Bug4168625Test().run(args);
62 }
63
64 /**
65 * Verify that getBundle will do something reasonable when part of the
66 * resource hierarchy is missing.
67 */
68 public void testMissingParent() throws Exception {
69 final Locale oldDefault = Locale.getDefault();
70 Locale.setDefault(new Locale("en", "US"));
71 try {
72 final Locale loc = new Locale("jf", "jf");
73 ResourceBundle bundle = ResourceBundle.getBundle("Bug4168625Resource2", loc);
74 final String s1 = bundle.getString("name");
75 if (!s1.equals("Bug4168625Resource2_en_US")) {
76 errln("getBundle did not find leaf bundle: "+bundle.getClass().getName());
77 }
78 final String s2 = bundle.getString("baseName");
79 if (!s2.equals("Bug4168625Resource2")) {
80 errln("getBundle did not set up proper inheritance chain");
81 }
82 } finally {
83 Locale.setDefault(oldDefault);
84 }
85 }
86
87 /**
88 * Previous versions of ResourceBundle have had the following
89 * caching behavior. Assume the classes
90 * Bug4168625Resource_fr_FR, Bug4168625Resource_fr,
91 * Bug4168625Resource_en_US, and Bug4168625Resource_en don't
92 * exist. The class Bug4168625Resource does. Assume the default
93 * locale is en_US.
94 * <P>
95 * <pre>
96 * getBundle("Bug4168625Resource", new Locale("fr", "FR"));
97 * -->try to load Bug4168625Resource_fr_FR
98 * -->try to load Bug4168625Resource_fr
99 * -->try to load Bug4168625Resource_en_US
100 * -->try to load Bug4168625Resource_en
101 * -->load Bug4168625Resource
102 * -->cache Bug4168625Resource as Bug4168625Resource
103 * -->cache Bug4168625Resource as Bug4168625Resource_en
104 * -->cache Bug4168625Resource as Bug4168625Resource_en_US
105 * -->return Bug4168625Resource
106 * getBundle("Bug4168625Resource", new Locale("fr", "FR"));
107 * -->try to load Bug4168625Resource_fr_FR
108 * -->try to load Bug4168625Resource_fr
109 * -->find cached Bug4168625Resource_en_US
110 * -->return Bug4168625Resource_en_US (which is realy Bug4168625Resource)
111 * </pre>
112 * <P>
113 * The second call causes two loads for Bug4168625Resource_fr_FR and
114 * Bug4168625Resource_en which have already been tried and failed. These
115 * two loads should have been cached as Bug4168625Resource by the first
116 * call.
117 *
118 * The following, more efficient behavior is desired:
119 * <P>
120 * <pre>
121 * getBundle("Bug4168625Resource", new Locale("fr", "FR"));
122 * -->try to load Bug4168625Resource_fr_FR
123 * -->try to load Bug4168625Resource_fr
124 * -->try to load Bug4168625Resource_en_US
125 * -->try to load Bug4168625Resource_en
126 * -->load Bug4168625Resource
127 * -->cache Bug4168625Resource as Bug4168625Resource
128 * -->cache Bug4168625Resource as Bug4168625Resource_en
129 * -->cache Bug4168625Resource as Bug4168625Resource_en_US
130 * -->cache Bug4168625Resource as Bug4168625Resource_fr
131 * -->cache Bug4168625Resource as Bug4168625Resource_fr_FR
132 * -->return Bug4168625Resource
133 * getBundle("Bug4168625Resource", new Locale("fr", "FR"));
134 * -->find cached Bug4168625Resource_fr_FR
135 * -->return Bug4168625Resource_en_US (which is realy Bug4168625Resource)
136 * </pre>
137 * <P>
138 *
139 */
140 public void testCacheFailures() throws Exception {
141 checkResourceLoading("Bug4168625Resource", new Locale("fr", "FR"));
142 }
143
144 /**
145 * Previous versions of ResourceBundle have had the following
146 * caching behavior. Assume the current locale is locale is en_US.
147 * The classes Bug4168625Resource_en_US, and Bug4168625Resource_en don't
148 * exist. The class Bug4168625Resource does.
149 * <P>
150 * <pre>
151 * getBundle("Bug4168625Resource", new Locale("en", "US"));
152 * -->try to load Bug4168625Resource_en_US
153 * -->try to load Bug4168625Resource_en
154 * -->try to load Bug4168625Resource_en_US
155 * -->try to load Bug4168625Resource_en
156 * -->load Bug4168625Resource
157 * -->cache Bug4168625Resource as Bug4168625Resource
158 * -->cache Bug4168625Resource as Bug4168625Resource_en
159 * -->cache Bug4168625Resource as Bug4168625Resource_en_US
160 * -->return Bug4168625Resource
161 * </pre>
162 * <P>
163 * The redundant loads of Bug4168625Resource_en_US and Bug4168625Resource_en
164 * should not occur. The desired behavior is as follows:
165 * <P>
166 * <pre>
167 * getBundle("Bug4168625Resource", new Locale("en", "US"));
168 * -->try to load Bug4168625Resource_en_US
169 * -->try to load Bug4168625Resource_en
170 * -->load Bug4168625Resource
171 * -->cache Bug4168625Resource as Bug4168625Resource
172 * -->cache Bug4168625Resource as Bug4168625Resource_en
173 * -->cache Bug4168625Resource as Bug4168625Resource_en_US
174 * -->return Bug4168625Resource
175 * </pre>
176 * <P>
177 */
178 public void testRedundantLoads() throws Exception {
179 checkResourceLoading("Bug4168625Resource", Locale.getDefault());
180 }
181
182 /**
183 * Ensure that resources are only loaded once and are cached correctly
184 */
185 private void checkResourceLoading(String resName, Locale l) throws Exception {
186 final Loader loader = new Loader( new String[] { "Bug4168625Class" }, new String[] { "Bug4168625Resource3_en_US", "Bug4168625Resource3_en_CA" });
187 final Class c = loader.loadClass("Bug4168625Class");
188 Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
189 final String resClassName;
190 if (l.toString().length() > 0) {
191 resClassName = resName+"_"+l;
192 } else {
193 resClassName = resName;
194 }
195
196 Object bundle = test.getResourceBundle(resName, l);
197 loader.logClasses("Initial lookup of "+resClassName+" generated the following loads:");
198
199 final Vector lastLoad = new Vector(loader.loadedClasses.size());
200 boolean dups = false;
201 for (int i = loader.loadedClasses.size() - 1; i >= 0 ; i--) {
202 final Object item = loader.loadedClasses.elementAt(i);
203 loader.loadedClasses.removeElementAt(i);
204 if (loader.loadedClasses.contains(item)) {
205 logln("Resource loaded more than once: "+item);
206 dups = true;
207 } else {
208 lastLoad.addElement(item);
209 }
210 }
211 if (dups) {
212 errln("ResourceBundle loaded some classes multiple times");
213 }
214
215 loader.loadedClasses.removeAllElements();
216 bundle = test.getResourceBundle(resName, l);
217 loader.logClasses("Second lookup of "+resClassName+" generated the following loads:");
218
219 dups = false;
220 for (int i = 0; i < loader.loadedClasses.size(); i++) {
221 Object item = loader.loadedClasses.elementAt(i);
222 if (lastLoad.contains(item)) {
223 logln("ResourceBundle did not cache "+item+" correctly");
224 dups = true;
225 }
226 }
227 if (dups) {
228 errln("Resource bundle not caching some classes properly");
229 }
230 }
231
duke6e45e102007-12-01 00:00:00 +0000232 private class ConcurrentLoadingThread extends Thread {
233 private Loader loader;
234 public Object bundle;
235 private Bug4168625Getter test;
236 private Locale locale;
237 private String resourceName = "Bug4168625Resource3";
238 public ConcurrentLoadingThread(Loader loader, Bug4168625Getter test, Locale l, String resourceName) {
239 this.loader = loader;
240 this.test = test;
241 this.locale = l;
242 this.resourceName = resourceName;
243 }
244 public ConcurrentLoadingThread(Loader loader, Bug4168625Getter test, Locale l) {
245 this.loader = loader;
246 this.test = test;
247 this.locale = l;
248 }
249 public void run() {
250 try {
251 logln(">>"+threadName()+">run");
252 bundle = test.getResourceBundle(resourceName, locale);
253 } catch (Exception e) {
254 errln("TEST CAUGHT UNEXPECTED EXCEPTION: "+e);
255 } finally {
256 logln("<<"+threadName()+"<run");
257 }
258 }
259 public synchronized void waitUntilPinged() {
260 logln(">>"+threadName()+">waitUntilPinged");
261 loader.notifyEveryone();
262 try {
263 wait(30000); //wait 30 seconds max.
264 } catch (InterruptedException e) {
265 logln("Test deadlocked.");
266 }
267 logln("<<"+threadName()+"<waitUntilPinged");
268 }
269 public synchronized void ping() {
270 logln(">>"+threadName()+">ping "+threadName(this));
271 notifyAll();
272 logln("<<"+threadName()+"<ping "+threadName(this));
273 }
274 };
275
276 /**
277 * This test ensures that multiple resources can be loading at the same
278 * time as long as they don't depend on each other in some way.
279 */
naoto2071ff62010-10-22 11:32:26 -0700280 public void testConcurrentLoading() throws Exception {
duke6e45e102007-12-01 00:00:00 +0000281 final Loader loader = new Loader( new String[] { "Bug4168625Class" }, new String[] { "Bug4168625Resource3_en_US", "Bug4168625Resource3_en_CA" });
282 final Class c = loader.loadClass("Bug4168625Class");
283 final Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
284
285 ConcurrentLoadingThread thread1 = new ConcurrentLoadingThread(loader, test, new Locale("en", "CA"));
286 ConcurrentLoadingThread thread2 = new ConcurrentLoadingThread(loader, test, new Locale("en", "IE"));
287
288 thread1.start(); //start thread 1
289 loader.waitForNotify(1); //wait for thread1 to do getBundle & block in loader
290 thread2.start(); //start second thread
291 thread2.join(1000); //wait until thread2 blocks somewhere in getBundle
292
293 //Thread1 should be blocked inside getBundle at the class loader
294 //Thread2 should have completed its getBundle call and terminated
295 if (!thread1.isAlive() || thread2.isAlive()) {
296 errln("ResourceBundle.getBundle not allowing legal concurrent loads");
297 }
298
299 thread1.ping(); //continue thread1
300 thread1.join();
301 thread2.join();
302 }
303
304 /**
305 * This test ensures that a resource loads correctly (with all its parents)
306 * when memory is very low (ex. the cache gets purged during a load).
307 */
308 public void testLowMemoryLoad() throws Exception {
309 final String[] classToLoad = { "Bug4168625Class" };
310 final String[] classToWait = { "Bug4168625Resource3_en_US","Bug4168625Resource3_en","Bug4168625Resource3" };
311 final Loader loader = new Loader(classToLoad, classToWait);
312 final Class c = loader.loadClass("Bug4168625Class");
313 final Bug4168625Getter test = (Bug4168625Getter)c.newInstance();
314 causeResourceBundleCacheFlush();
315
316 ConcurrentLoadingThread thread1 = new ConcurrentLoadingThread(loader, test, new Locale("en", "US"));
317 thread1.start(); //start thread 1
318 loader.waitForNotify(1); //wait for thread1 to do getBundle(en_US) & block in loader
319 causeResourceBundleCacheFlush(); //cause a cache flush
320 thread1.ping(); //kick thread 1
321 loader.waitForNotify(2); //wait for thread1 to do getBundle(en) & block in loader
322 causeResourceBundleCacheFlush(); //cause a cache flush
323 thread1.ping(); //kick thread 1
324 loader.waitForNotify(3); //wait for thread1 to do getBundle(en) & block in loader
325 causeResourceBundleCacheFlush(); //cause a cache flush
326 thread1.ping(); //kick thread 1
327 thread1.ping(); //kick thread 1
328 thread1.join(1000); //wait until thread2 blocks somewhere in getBundle
329
330 ResourceBundle bundle = (ResourceBundle)thread1.bundle;
331 String s1 = bundle.getString("Bug4168625Resource3_en_US");
332 String s2 = bundle.getString("Bug4168625Resource3_en");
333 String s3 = bundle.getString("Bug4168625Resource3");
334 if ((s1 == null) || (s2 == null) || (s3 == null)) {
335 errln("Bundle not constructed correctly. The parent chain is incorrect.");
336 }
337 }
338
339 /**
340 * A simple class loader that loads classes from the current
341 * working directory. The loader will block the current thread
342 * of execution before it returns when it tries to load
343 * the class "Bug4168625Resource3_en_US".
344 */
345 private static final String CLASS_PREFIX = "";
346 private static final String CLASS_SUFFIX = ".class";
347
348 private static final class SimpleLoader extends ClassLoader {
349 private boolean network = false;
350
351 public SimpleLoader() {
mchung019ce7d2010-06-15 20:34:49 -0700352 super(SimpleLoader.class.getClassLoader());
duke6e45e102007-12-01 00:00:00 +0000353 this.network = false;
354 }
355 public SimpleLoader(boolean simulateNetworkLoad) {
mchung019ce7d2010-06-15 20:34:49 -0700356 super(SimpleLoader.class.getClassLoader());
duke6e45e102007-12-01 00:00:00 +0000357 this.network = simulateNetworkLoad;
358 }
359 public Class loadClass(final String className, final boolean resolveIt)
360 throws ClassNotFoundException {
361 Class result;
362 synchronized (this) {
363 result = findLoadedClass(className);
364 if (result == null) {
365 if (network) {
366 try {
367 Thread.sleep(100);
368 } catch (java.lang.InterruptedException e) {
369 }
370 }
mchung019ce7d2010-06-15 20:34:49 -0700371 result = getParent().loadClass(className);
duke6e45e102007-12-01 00:00:00 +0000372 if ((result != null) && resolveIt) {
373 resolveClass(result);
374 }
375 }
376 }
377 return result;
378 }
379 }
380
381 private final class Loader extends ClassLoader {
382 public final Vector loadedClasses = new Vector();
383 private String[] classesToLoad;
384 private String[] classesToWaitFor;
385
386 public Loader() {
mchung019ce7d2010-06-15 20:34:49 -0700387 super(Loader.class.getClassLoader());
duke6e45e102007-12-01 00:00:00 +0000388 classesToLoad = new String[0];
389 classesToWaitFor = new String[0];
390 }
391
392 public Loader(final String[] classesToLoadIn, final String[] classesToWaitForIn) {
mchung019ce7d2010-06-15 20:34:49 -0700393 super(Loader.class.getClassLoader());
duke6e45e102007-12-01 00:00:00 +0000394 classesToLoad = classesToLoadIn;
395 classesToWaitFor = classesToWaitForIn;
396 }
397
398 /**
399 * Load a class. Files we can load take preference over ones the system
400 * can load.
401 */
402 private byte[] getClassData(final String className) {
403 boolean shouldLoad = false;
404 for (int i = classesToLoad.length-1; i >= 0; --i) {
405 if (className.equals(classesToLoad[i])) {
406 shouldLoad = true;
407 break;
408 }
409 }
410
411 if (shouldLoad) {
412 final String name = CLASS_PREFIX+className+CLASS_SUFFIX;
413 try {
414 final InputStream fi = this.getClass().getClassLoader().getResourceAsStream(name);
415 final byte[] result = new byte[fi.available()];
416 fi.read(result);
417 return result;
418 } catch (Exception e) {
419 logln("Error loading test class: "+name);
420 logln(e.toString());
421 return null;
422 }
423 } else {
424 return null;
425 }
426 }
427
428 /**
429 * Load a class. Files we can load take preference over ones the system
430 * can load.
431 */
432 public Class loadClass(final String className, final boolean resolveIt)
433 throws ClassNotFoundException {
434 Class result;
435 synchronized (this) {
436 logln(">>"+threadName()+">load "+className);
437 loadedClasses.addElement(className);
438
439 result = findLoadedClass(className);
440 if (result == null) {
441 final byte[] classData = getClassData(className);
442 if (classData == null) {
443 //we don't have a local copy of this one
444 logln("Loading system class: "+className);
445 result = loadFromSystem(className);
446 } else {
447 result = defineClass(classData, 0, classData.length);
448 if (result == null) {
449 //there was an error defining the class
450 result = loadFromSystem(className);
451 }
452 }
453 if ((result != null) && resolveIt) {
454 resolveClass(result);
455 }
456 }
457 }
458 for (int i = classesToWaitFor.length-1; i >= 0; --i) {
459 if (className.equals(classesToWaitFor[i])) {
460 rendezvous();
461 break;
462 }
463 }
464 logln("<<"+threadName()+"<load "+className);
465 return result;
466 }
467
468 /**
mchung019ce7d2010-06-15 20:34:49 -0700469 * Delegate loading to its parent class loader that loads the test classes.
470 * In othervm mode, the parent class loader is the system class loader;
471 * in samevm mode, the parent class loader is the jtreg URLClassLoader.
duke6e45e102007-12-01 00:00:00 +0000472 */
473 private Class loadFromSystem(String className) throws ClassNotFoundException {
mchung019ce7d2010-06-15 20:34:49 -0700474 return getParent().loadClass(className);
duke6e45e102007-12-01 00:00:00 +0000475 }
476
477 public void logClasses(String title) {
478 logln(title);
479 for (int i = 0; i < loadedClasses.size(); i++) {
480 logln(" "+loadedClasses.elementAt(i));
481 }
482 logln("");
483 }
484
485 public int notifyCount = 0;
486 public int waitForNotify(int count) {
487 return waitForNotify(count, 0);
488 }
489 public synchronized int waitForNotify(int count, long time) {
490 logln(">>"+threadName()+">waitForNotify");
491 if (count > notifyCount) {
492 try {
493 wait(time);
494 } catch (InterruptedException e) {
495 }
496 } else {
497 logln(" count("+count+") > notifyCount("+notifyCount+")");
498 }
499 logln("<<"+threadName()+"<waitForNotify");
500 return notifyCount;
501 }
502 private synchronized void notifyEveryone() {
503 logln(">>"+threadName()+">notifyEveryone");
504 notifyCount++;
505 notifyAll();
506 logln("<<"+threadName()+"<notifyEveryone");
507 }
508 private void rendezvous() {
509 final Thread current = Thread.currentThread();
510 if (current instanceof ConcurrentLoadingThread) {
511 ((ConcurrentLoadingThread)current).waitUntilPinged();
512 }
513 }
514 }
515
516 private static String threadName() {
517 return threadName(Thread.currentThread());
518 }
519
520 private static String threadName(Thread t) {
521 String temp = t.toString();
522 int ndx = temp.indexOf("Thread[");
523 temp = temp.substring(ndx + "Thread[".length());
524 ndx = temp.indexOf(',');
525 temp = temp.substring(0, ndx);
526 return temp;
527 }
528
529 /** Fill memory to force all SoftReferences to be GCed */
530 private void causeResourceBundleCacheFlush() {
531 logln("Filling memory...");
532 int allocationSize = 1024;
533 Vector memoryHog = new Vector();
534 try {
535 while (true) {
536 memoryHog.addElement(new byte[allocationSize]);
537 allocationSize *= 2;
538 }
539 } catch (Throwable e) {
540 logln("Caught "+e+" filling memory");
541 } finally{
542 memoryHog = null;
543 System.gc();
544 }
545 logln("last allocation size: " + allocationSize);
546 }
547
548 /**
549 * NOTE: this problem is not externally testable and can only be
550 * verified through code inspection unless special code to force
551 * a task switch is inserted into ResourceBundle.
552 * The class Bug4168625Resource_sp exists. It's parent bundle
553 * (Bug4168625Resource) contains a resource string with the tag
554 * "language" but Bug4168625Resource_sp does not.
555 * Assume two threads are executing, ThreadA and ThreadB and they both
556 * load a resource Bug4168625Resource with from sp locale.
557 * ResourceBundle.getBundle adds a bundle to the bundle cache (in
558 * findBundle) before it sets the bundle's parent (in getBundle after
559 * returning from findBundle).
560 * <P>
561 * <pre>
562 * ThreadA.getBundle("Bug4168625Resource", new Locale("sp"));
563 * A-->load Bug4168625Resource_sp
564 * A-->find cached Bug4168625Resource
565 * A-->cache Bug4168625Resource_sp as Bug4168625Resource_sp
566 * ThreadB.getBundle("Bug4168625Resource", new Locale("sp"));
567 * B-->find cached Bug4168625Resource_sp
568 * B-->return Bug4168625Resource_sp
569 * ThreadB.bundle.getString("language");
570 * B-->try to find "language" in Bug4168625Resource_sp
571 * B-->Bug4168625Resource_sp does not have a parent, so return null;
572 * ThreadB.System.out.println("Some unknown country");
573 * A-->set parent of Bug4168625Resource_sp to Bug4168625Resource
574 * A-->return Bug4168625Resource_sp (the same bundle ThreadB got)
575 * ThreadA.bundle.getString("language");
576 * A-->try to find "language" in Bug4168625Resource_sp
577 * A-->try to find "language" in Bug4168625Resource (parent of Bug4168625Resource_sp)
578 * A-->return the string
579 * ThreadA.System.out.println("Langauge = "+country);
580 * ThreadB.bundle.getString("language");
581 * B-->try to find "language" in Bug4168625Resource_sp
582 * B-->try to find "language" in Bug4168625Resource (parent of Bug4168625Resource_sp)
583 * B-->return the string
584 * ThreadB.System.out.println("Langauge = "+country);
585 * </pre>
586 * <P>
587 * Note that the first call to getString() by ThreadB returns null, but the second
588 * returns a value. Thus to ThreadB, the bundle appears to change. ThreadA gets
589 * the expected results right away.
590 */
591}