• 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

Synchronized data

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I'm faced with a bit of a dilemma: I'd like to learn as much as i can from this, and i'd like to finish this project before it finishes me.
I'm doing the B&S assignment. For locking, to make sure there are no deadlocks, dirty reads, concurrent writes, etc, i'm considering making a synchronized data class, a la Collections.synchronizedList/Set/Map. In other words, my service facade will be working strictly with all synchronized methods, i would imagine, with no chance of concurrency problem, both in local and network (rmi, in my case) modes.

I could also do a reader/writer implementation with monitors, signaling, record-level locking, etc, but there is a whole lot more of a chance i'll screw that up.

What are the chances i'll be failed for this solution?

Thank you,

| eg
[ July 20, 2004: Message edited by: Ed Green ]
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ed,

You might have read that folks here are getting 44/80 for incomplete locking scenarios. That's a big chunk of your room to score.

As someone who is still waiting for his results, let me suggest: Keep it simple. Leverage existing Java multithreading mechanisms. Consider using wait and notify and make sure you understand how they would help you. My data class was synchronized on all methods (except lock() and unlock(), but only because they were synchronized by method calls within a helper class)

Also, I have reposted the code I used to test my database class. It might be something you want to take a look at, particularly if you find something wrong!! :b
 
Ed Green
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Tnx for the response, where can i find your test code?
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's posted as a separate topic: My Test Code for DB Locking, etc. I hope this URL will work for you: https://coderanch.com/t/185948/java-developer-SCJD/certification/Test-Code-DB-Locking

RK
 
That's a very big dog. I think I want to go home now and hug 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