This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S 2.1.1 non-networked mode locking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S 2.1.1 non-networked mode locking" Watch "B&S 2.1.1 non-networked mode locking" New topic

B&S 2.1.1 non-networked mode locking

Mostafa Radwan

Joined: Sep 09, 2003
Posts: 25
Hi All,
I am working on B&S 2.1.1 and in the design & analysis phase.

I am not quite sure if there's any locking needed when running the application in a standalone mode.

It mentioned in the specs "You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent client of your server".

Does that mean locking should be implemented only for the network-mode ? Please advise.


- Mostafa Radwan -
M.Sc | SCJP 1.4
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Mostafa,

Mostafa Radwan wrote:I am not quite sure if there's any locking needed when running the application in a standalone mode.

The code in your Data class must be 100% agnostic of the mode how the GUI chooses to run the application either standalone or server.

If you make it mode aware it would be extremely complex and difficult to maintain.

Look for simplicity and generic and easy to maintain and to extend but the Data class should not have any knowledge at all of how
the client code chooses to run it.

Hope this helps,

Mxolisi Veco
Ranch Hand

Joined: Jan 14, 2010
Posts: 59
Good day Mostafa.

I have a BusinessServices class that I use when the application is in stand alone mode or in server mode.
The BusinessServices class locks a record; does anything it needs to do; unlock the record.

Locking records in stand alone mode will not cause the program to fall over and it will not corrupt the database.
So I do not see anything wrong with locking records in standalone mode.
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2270

Champions, I just want to add that the locking mechanism must work in both standalone and networked mode, otherwise, the candidate will be automatically failed.

And I agree with Carlos: the Data class must not know how the application is being run.

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
I agree. Here's the link:
subject: B&S 2.1.1 non-networked mode locking
jQuery in Action, 3rd edition