File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When is lock released?

 
Maria Garcia
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a) yield
b) sleep
c) interrupt
d) wait
e) stop
f) suspend
 
Dan Culache
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic