• Post Reply Bookmark Topic Watch Topic
  • New Topic

Locking the Complete Database  RSS feed

Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had originally thought that my project might be simpler
than others, because certain things were missing from it:
the cookie, the -1 to mean lock the complete database,
and the like.
However, in a world where I very well might not have stumbled
upon the resources of this group, my project actually would
have been harder, because even though there is no hint
that the database needs to be locked down, certainly the database
does need to be locked down prior to shutting down the server.
And, quite frankly, I would never have thought of locking the
complete database, and if it crossed my mind, I probably would
have said "they don't really require that."
So, my question deals with shutting down the database. That is,
how do you do it?
Here is my new outline. The server-side system has a method which
tells interested business methods whether the server is now locked
down. The business method, if it determines that the server is now
locked down, aborts and sends a message to the user: such as
"Server has been locked down: please try again later."
If a business method has already started processing, that is, when it
made the initial test, the database was not locked down, then it continues
until it completes.
All business methods doing simple reads, also should not read any data
when the database is locked down, but should return a friendly message
to the user.
Finally, on the server side, there needs to be some logic, which I haven't
worked out in detail, which is aware, perhaps hueristically, that the database
is no longer being used: that is, a certain amount of time has passed and
there have been no reads or writes against the database. The server-side
then concludes that it is locked down. Perhaps this is called: lockDownOfDbIsConfirmed
is set to true.
Now, once lockDownOfDbIsConfirmed is true, then and only then is it
okay to quit from the server application.
Does this sound like a reasonable outline for locking down the database?
Javini Javono
Mark Spritzler
Posts: 17309
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds kind of over-complicated for this assignment to me. But I could be wrong.
When shutting down, I called lock(-1) which would lock the entire database, so if a user had a lock the shutting down process would have to wait till that lock is available, then get it itself. When the shutting down process has all the locks then it shuts down the server. At this point, because I have Exceptions thrown up to clients, the clients that still have their GUI's up, would get a nice message saying that the server is unavailable.
Straight-forward and simple.
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming you lock down the entire DB to shut it down so that no other thread can interact or intracting with the DB am I right? If this is right, I don't see how you claim the lock of the DB object can stop other threads using it unless you make all your methods synchronized. That could be a big performance hit. If you guys have a lockedRecords that every write to the DB has to claim the lock on it, then I would just claim the lock of lockedRecords then shut down. Once the lock is claimed, that would mean no other threads are writing to the DB and is safe to shut down. Reads can't screw your DB up (not suppose to anyway). Of course sending a msg back to the client before System.exit(); too would be nice. But that would be a client timeout thing, not the server's job.
If you mean locking the entire DB so that another program can't shut it down while it is shutting down by your program, then I think you can assume that is not a requirement for your assignment. It is not a requirement for mine anyway... Bodgitt and Scarper
Well these are my thoughts, I have just wrote my DB and going to the testing stage.
[ February 15, 2004: Message edited by: Anna Kafei ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!