permaculture playing cards*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes When is lock released? 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 » Programmer Certification (SCJP/OCPJP)
Bookmark "When is lock released?" Watch "When is lock released?" New topic
Author

When is lock released?

Maria Garcia
Ranch Hand

Joined: Jul 14, 2002
Posts: 86
a) yield
b) sleep
c) interrupt
d) wait
e) stop
f) suspend


SCJP 1.4
Dan Culache
Ranch Hand

Joined: Jan 24, 2003
Posts: 70
Hi Maria,
I would say:
d) wait it's an Object method and releases the lock on the particular object whose reference was used to call it.
e) stop it's a Thread method and releases all the locks one Thread has.
------------
a) yield keeps the locks and only allows Threads that are in a runnable state (not waiting on a lock for instance) to run.
b) sleep keeps the lock and temporarily cease execution for the specified time
c) interrupt is called from another Thread on a Thread that is waiting, sleeping, or blocked in a I/O
d) suspend holds its threads.
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
It was my experience that the deprecated thread methods, stop, suspend and resume, do not appear on the exam. Of course, further input from Kathy or Bert would be helpful.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When is lock released?