• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

non-networked mode and locking

 
Red Marshall
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i've just had a thought regarding URLyBird and the non-networked mode and locking. It seems silly to think that in non-networked mode theres any use at all for locking records - i'm assuming that in this mode, theres only ever 1 client running and the db is not being shared.

So in my biz tier classes (book, search) my local biz class wont use the locking methods provided by the Data class at all.

However it just occured to me..what if a client in non-networked mode is running on the same machine as the server, and both are using the same database file? Has anyone considered this?

I'd really like to know if any thinks that any book() call should use locking, regardless of whether the client is in non-networked mode.

Regards,

Red
 
Red Marshall
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just came up with another brain teaser

scenario: My data.java is a singleton..i've done because it seemed logical as 2 clients accessing the same db file must be using the same instance of data.java.

but what happens when you have 2 clients, accessing different db files? The singleton pattern no longer works as 2 distinct instances of data.java are now needed for each db file.

There is a workaround to this by modifying the singleton pattern so that data.java now has a static map of data.java instances where the key is the db filename.

This seems like overkill..ne thoughts?
 
Ta Ri Ki Sun
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Red Marshall:
what if a client in non-networked mode is running on the same machine as the server, and both are using the same database file? Has anyone considered this?


No need to consider it, you may assume that at any given time at most one client is accessing the database, you'll find words to that effect in your instructions.
The "client" in this context includes your server as that's a database client.
 
Red Marshall
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the post

my follow up reply is still concerning me however. Its possible that 2 or more instances of this system will be running..each using different db files.

But this is prob ok if your program dosnt allow this - hopefully.

Does your business methods in the non-networked mode call any of the locking methods?

i.e.

book()
{
dataInstance.lock()
..processing
dataInstance.unlock()
}

my design at moment means that the data.java methods create/update/delete assume that only 1 client is calling the method at that time. So i was going to handle all the locking within the business methods. (Bad?)

In that case whats the point of using locking at all in the business methods for the non-networked mode.

all the best,

red
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic