wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Remove synchronized from the data methods? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Remove synchronized from the data methods?" Watch "Remove synchronized from the data methods?" New topic
Author

Remove synchronized from the data methods?

peter yuan
Greenhorn

Joined: Apr 04, 2002
Posts: 1
hi, everybody:
i just came to this wonderful forum and so happy to talk with you guys. u know, last week, i download the developer assignment and busy thinking the issues. i have to admit it is a great challenge to me and finally, hope to make the assignment well done at last.
some methods in the Data class has synchronized key word. and in my understanding, if we design the lock and unlock method, and implement them, the synchronized key word should be removed. and it is what Sun want us to do: synchronize the "write" function in the record level. Am i thinking right? hope to get reply from people staying here.
thank you very much!
peter yuan
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I would not remove the Synchronized keyword form the Data class methods.
Read these posts
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=25&t=002257
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
morten wilken
Greenhorn

Joined: May 25, 2002
Posts: 13
hi all,
if i understand correctly then, if you do not remove the synchronized from modify() then the entire database is locked for the duration of the modify method, and not just the record?
please correct me if im wrong
hmm... but perhaps this is desired, so another client cannot seek() something else in the middle of the modify operation.
sincerely
morten wilken
Originally posted by Mark Spritzler:
I would not remove the Synchronized keyword form the Data class methods.
Read these posts
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=25&t=002257
Mark
dean tomlinson
Ranch Hand

Joined: Jan 31, 2002
Posts: 94
hi morten,
if i understand correctly then, if you do not remove the synchronized from modify() then the entire database is locked for the duration of the modify method, and not just the record?

the modify method, is where the physical writing of the new data occurs, so it is important that this is not done at the same time as any of the other syncd methods (add, delete, getrecord etc) otherwise the underlying database file could be corrputed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remove synchronized from the data methods?
 
Similar Threads
NX: 5 problems about Data.java
lock/unlock & synchronized
synchronized in local mode
[URLyBird] Synchronization issues and null terminated fields problems
Synchronization uncovered