This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Lock/unlock please comment my code

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please comment my code ...


Thanks,
Tony

[ August 07, 2006: Message edited by: Tony Bouer ]
[ August 07, 2006: Message edited by: Tony Bouer ]
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you mean:

in lock()
lockMap.put(new Long(recNo), new Long(lockID++));

in unlock()
lockMap.remove(new Long(recNo));
 
Tony Bouer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I updated the code ... by the way I would like to give attention to locking mechanism by itself with synchronized method, wait() and notify.

I appreciate any comments on the code !
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With notify in your code, you risk deadlock. Read documentation.
 
Tony Bouer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
updating ...


[ August 07, 2006: Message edited by: Tony Bouer ]
 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read SCJD FAQ.

... you may not post your entire code for locking and unlocking records - this is a major section (currently worth 20% of the assignment) and sections of such code will be removed from any post. Posting just one method (e.g. the lock() method is usually considered reasonable).

There are multiple reasons for this policy:
* Sun do not allow you to share your assignment or a solution to the assignment with others.
* You have spent time and effort getting your solution right. It would not be right for someone else to just copy your solution without working it out for themselves.
* If someone did get awarded the SCJD certification after copying your code, and were then given employment because they had that certification, the employer would probably find that the employee cannot actually do the work. Which makes the perceived value of this certificate decrease.
* If people post too much code, then Sun may, in the future, request that we do not allow any SCJD code to be posted.



Regards
 
Tony Bouer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removed code as requested ... I´┐Żll try to describe just the algorithm on the future.
Thanks,
Tony
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!