• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

required lock and unlock methods.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From my understanding of threads the synchronized key word provides the locking mechanism. The SCJD assignment from SUN requires the implementation of the lock(int record) and unlock(int record). I have searched the web using google, the usenet news groups
using google groups, several java text books I have and this forum. I am looking for an example or tutorial that has java code demonstrating the concept the SCJD exam requires. Please point me to a tutorial, faq, or java source code that demonstrates this concept. Thank you in advance for your help.
Michael mciaccio@houston.rr.com
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Synchronized locks the object for the period of the method call. That is not a lock on the record while the user is using it to read then modify.
Have you searched on "lock" in this forum. It says you have, but there are a pleathora (Spelling?) of posts here that show you what the code can look like.
Basically you want to track which records the user has locked, and allow them to unlock the records that they have locked. While Synchronize keyword is used when you are calling the method, it doesn't relate to locking a record.
Mark
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic