File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Testing - Max's Book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Testing - Max Watch "Testing - Max New topic
Author

Testing - Max's Book

Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175
Hi Max,
In your book, there is a test package. I don't quite understand some code in DBTestRunner.java, that is,
while (test1.isAlive()
&& test2.isAlive()
&& test3.isAlive()
&& test4.isAlive()
&& test5.isAlive()
&& test1.isAlive()) {
}
System.out.println("Completed all tests.");
This means that if one thread is dead, then the test is completed. Why?
As I imagine, if the test is completed, then all thread should be dead. Can you explain?


Thanks,<br />Mike
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
HI Mike,
I don't have the book handy. Can you give me a little more context?
M


Java Regular Expressions
Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175
Hi Max,
The following is the full code:

[Andrew: I have put the code in between a UBB [code] and [/code] tags. This ensures that indenting is preserved, and makes the code easier to read. If you edit this post, you will see what I have done.]
[ September 16, 2003: Message edited by: Andrew Monkhouse ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Good point, this seems to be a bug. I'd suggest replacing the while loop with:
test1.join();
test2.join();
test3.join();
test4.join();
test5.join();
test6.join();
This could at least be done in the downloadable verion of the code, right? The code is also listed on p. 333; guess that need to be in the errata.


"I'm not back." - Bill Harding, Twister
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Bump.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11437
    
  85

Bump again


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
 
subject: Testing - Max's Book