Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

close the file on the server

 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic