aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads - suspend() and resume() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads - suspend() and resume()" Watch "Threads - suspend() and resume()" New topic
Author

Threads - suspend() and resume()

eskay kumar
Ranch Hand

Joined: Jul 22, 2000
Posts: 71
Hi,
This qn is from Jxam.

options are :
1)1 2 3 4
2)1 2 3
3)1 2
4)Nothing. This is not a valid way to create and start a thread.
5)1
Assuming deprecated methods will be considered 'ok' in the exam which is the correct ans.
ans given is 3) with the explaination :
"the code will run, but the thread suspends itself after displaying "2". Threads cannot un-suspend themselves (since they ARE suspended and therefore not running!)."
But i thought using resume() - would resume the thread, and the thread will execute again. Can soemone please expalin then what is the significance of resume - once a thread has been suspended, and how would one use it.
I have another favor to ask - i have a copy of RHE but the CD that came along with it is corrupted. I can't open the tester.jar file. Can someone please mail that to me at shilpakumar@hotmail.com
thanks a ton !
shilpa
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12678
    
    5
resume would resume the Thread BUT WHO WOULD CALL resume?
The only user Thread in the entire application is suspended indefinately! Sheeesh!
suspend and resume were used to enable multiple Threads to cooperate but are now deprecated because they did not work well with synchronized blocks.
public synchronized void doSomething(){
// stuff
suspend();
return ;
}
When the Thread is supended, the object is locked up as far as access by another Thread trying to call synchronized methods.
Bill


Java Resources at www.wbrogden.com
eskay kumar
Ranch Hand

Joined: Jul 22, 2000
Posts: 71
thanks Bill for replying !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads - suspend() and resume()
 
Similar Threads
Threads: suspend/resume and join
I need your help about a Thread question.(scjp03-Q56)
suspend() and resume()
Thread Q
Thread - suspend()