Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

locking the entire database(-1)

 
Ramesh kumaar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
Sun's Specification says
--------------------------------------------------
If the method is called with an argument of -1, the entire database should be locked.
--------------------------------------------------
What do they mean by the above statement. Who will call the lock(-1) client or server. if so what should be the effect of this. What is the need of doing this.
please all of u paricipate.

thanks & regards,
-rameshkumar
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Who will call the lock(-1) client or server. if so what should be the effect of this. What is the need of doing this.

A typical scenario would be a server (or database) administration who will need to do some database maintanance. So that client will call lock(-1), and as soon as it returns, the server can be safely shut down, without disturbing the transactions.
Eugene.
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eugene Kononov,
Thanks for ur immidiate response.
--------------------------------------------------
A typical scenario would be a server (or database) administration who will need to do some database
maintanance. So that client will call lock(-1), and as soon as it returns, the server can be safely shut down, without disturbing the transactions.
--------------------------------------------------
If the maintanance is done by the severAdmin how do the client program handle that.
Can i have a seperate program which will reside in the serverside, Does the job of database locking ie which will call the lock method with -1 as an argument.
regards,
-rameshkumar.
 
Robin Underwood
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server would call lock(-1) as part of its process of shutting down. Lock(-1) shouldn't need to be called from anywhere else for this assignment.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The server would call lock(-1) as part of its process of shutting down. Lock(-1) shouldn't need to be called from anywhere else for this assignment.

Just to clarify it, it think the right answer is that the server administrator will use client portion of the program (GUI) to call lock(-1) (that functionality may be password based).
But yes, for the purposes of these assignment, all we have to do is to implement lock(-1).
Eugene.
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I have planned to have a console based serverside program which will be executed when the Administrator, else I have plan to have a serverside GIU which will have a Button for starting the server, stopping the server, locking the database. Guys i need all ur feedback on this idea.
thanks,
-rameshkumar
 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
pls do tell me where is that lock(-1) method u are talking about.....
help needed
Rishi
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HelloAll,
Guys all of please participate in this topic.
thanks & regards,
-rameshkumar
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a simple Server gui, that had a menu with exit and help. There was one button on it to stop the server, and a status bar, which was just a JLabel in the South Region of the BorderLayout.
When the server admin clicked close, that is when it calls lock(-1) to lock all the records before shutting down the server. That way no client could corrupt the data when it closed.
Mark
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Mark.
Here still i have one thing to be cleared. If -1 is issued(database is locked) no more new client are allowed to book the seat but the existing client should complete their task without any problem. Am i right.
regards,
rameshkumar
 
barry b
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that for the SCJD you are over-complicating the design.
Lock (-1) could be issued by another program interfacing to the app, such as a database maintenance program.
Clients with existing locks would need to be able to complete their transactions and no new locks would be allowed.
For testing I put a menu option on the client app that allowed a database lock to be applied and then tried accessing from another client.
Keep it simple.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If -1 is issued(database is locked) no more new client are allowed to book the seat but the existing client should complete their task without any problem. Am i right.

If the client gets the lock befoer the server, yes. If not then the server will be shutdown before the user can lock the record.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic