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.
posted 13 years ago
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.
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.
posted 13 years ago
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?
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,
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database