wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes close the file on the server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "close the file on the server" Watch "close the file on the server" New topic
Author

close the file on the server

Daniela Ch
Ranch Hand

Joined: Dec 13, 2002
Posts: 96
Hi,
To shut down my RMI server, the user will have to controle-c.
I want to close the database file, should I use a Runtime.addShutDownHook() or is there a simpler way?
Also, should I make a call to lock(-1) before closing the file or should I shut down the server right away? What if a user is dead, I dont want to make the server wait 15 minutes before it shuts down...
Thanks
/Daniela
Chandu onwards
Greenhorn

Joined: Dec 23, 2002
Posts: 13
I have a GUI on the server side to start/stop the server.
i believe lock(-1) is not required towards meeting the requirements of the assignment.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

I want to close the database file, should I use a Runtime.addShutDownHook() or is there a simpler way?
Also, should I make a call to lock(-1) before closing the file or should I shut down the server right away? What if a user is dead, I dont want to make the server wait 15 minutes before it shuts down...

I would say don't bother with graceful server shutdown, or server GUI, or calling lock(-1), or dead users. Those are the bells and whistles that are beyond your requirements and they add nothing to the clarity/reusability of the design. I did none of them, and got a maximum score for my server design. You may want to think how you will implement the close() method (you don't want the remote users to close the database on the server), but nothing extra is required.
Eugene.
[ December 26, 2002: Message edited by: Eugene Kononov ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: close the file on the server