wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: synchronized Db-Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: synchronized Db-Interface" Watch "B&S: synchronized Db-Interface" New topic
Author

B&S: synchronized Db-Interface

Rudolph Jen
Ranch Hand

Joined: Nov 17, 2006
Posts: 37
Hi Guys,

I am confused. :roll:
At the moment I am working on my implementation of the provided Db-Interface and I would like to synchronize each method except 'lock' and 'unlock'.

I understand 'lock' in that way, that it should guarantie that only one client is able to delete or update a record. It does not mean, that Threads can accessing the db at the same time.

Problem: I would like to allow multiple access, but what is for example:
- Thread 1 is searching db
- Thread 2 is creating/deleting/updating at the same time??

Of course:
- Thread 1 could update recNo 10
- Thread 2 could delete recNo 12
BUT: - Thread 3 could not run find-method clearly

Either I am totally blind oder I don't get the point. I am only confused, because I could here only find very old Topic regarding this.

Any thoughts??


SCJP<br />SCJD (in progress)
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Rudolph Jen:
Hi Guys,

I am confused. :roll:
At the moment I am working on my implementation of the provided Db-Interface and I would like to synchronize each method except 'lock' and 'unlock'.

I understand 'lock' in that way, that it should guarantie that only one client is able to delete or update a record. It does not mean, that Threads can accessing the db at the same time.

Problem: I would like to allow multiple access, but what is for example:
- Thread 1 is searching db
- Thread 2 is creating/deleting/updating at the same time??

Of course:
- Thread 1 could update recNo 10
- Thread 2 could delete recNo 12
BUT: - Thread 3 could not run find-method clearly

Either I am totally blind oder I don't get the point. I am only confused, because I could here only find very old Topic regarding this.

Any thoughts??


Hi,
Have a look at this thread.

http://www.coderanch.com/t/183558/java-developer-SCJD/certification/NX-URLyBird-locking-dirty-reads

Also a recomend doing a search on the term "dirty read".

regards,
Mark


SCJP<br />SCJD
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: B&S: synchronized Db-Interface