• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronized data

 
Ed Green
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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 ]
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: http://www.coderanch.com/t/185948/java-developer-SCJD/certification/Test-Code-DB-Locking

RK
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic