• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forced to implement local locking

 
Kevin Mc Cusker
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
When in local mode i must not use any networking. I want to go beyond this andremove the unnecessay locking\unlocking for local mode too.

my data access class, data.java, implements a DBAccess which for example has the following method:

public void deleteRecord(long recNo, long lockCookie)...

Am I stuck now with having to implement the locking in local mode too? If not how can i get around it?

Thanks!
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're thinking wrong if you're implementing the entire database logic twice.

You only need it once, nicely decoupled from the user interface, and have either one of 2 access layers (networked or local) in between the user interface and database which route the traffic.
 
Kevin Mc Cusker
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not intending on implementing it twice, I just cant see how I can delete a record in local mode without having to also perform a lock, as the delete record method requires a lockCookie as a parameter.
 
Jon Kean
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you wont be deleting anything in local mode
 
Kevin Mc Cusker
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what about booking a record? updateRecord also requires a lockCookie.
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
What i am doing is in local mode dont validate the cookie, moreover, locking methods provide dummy implementations like:

 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YUGH.
The calculation and validation of the cookie is a clear responsibility of the database layer, which should know nothing at all about whether it's being run in standalone or networked mode.

You ARE in fact implementing your entire database layer twice if you do it like this.
 
Kevin Mc Cusker
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So i'm resigned to locking in local mode, right?
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Data instance is mainly composited of lockManager instance and a DAO that performs CRUD operations.
It's simple. If the specified lockManager instance is null, locking is bypassed.
And obviously locking is not needed in local mode since
your locking system only needs to be concerned with multiple concurrent clients of your server

[ September 09, 2006: Message edited by: Oricio Ocle ]
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You ARE in fact implementing your entire database layer twice if you do it like this.

Entire?
 
Thirumurugan Mylrajan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Oricio Ocle:

Entire?


More or less.

The spec says that the DB should be capable of handling multiple clients.

The database should not be concerned whether its running in standalone or networked mode. Thats the concern of the client/server.
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Database is a very abstract word.
Logical locking is completely out of "database" issues.
And, literaly:
; therefore your locking system only needs to be concerned with multiple concurrent clients of your server
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we do require locking in local mode i guess.. theres only a single client in this mode but for testing they can generate multiple threads and try to access the database or may be the database will be accessed by other applications running on the machine (which may work as client).. so i guess locking should be provided in Local mode also ..Can anyone verify this ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic