Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Terminating Server

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just wondering is it enough to terminate the server using the System.exit(0) command?
Thanks.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

That's what I used to terminate my server when user hits the button "Exit" or the menu-item "Quit".

Kind regards,
Roel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, if your server has no windows (like in my case), you can add a shutdownHook, which runs when the user hits Ctrl + C in the console window.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roberto Perillo wrote:if your server has no windows (like in my case)

Just out of curiosity: how did you retrieve the configuration settings (database location and port number), because that's the reason why I created a GUI window.

Kind regards,
Roel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, my good buddy Roel! Long time no talk! I hope you're doing well.

Just out of curiosity: how did you retrieve the configuration settings (database location and port number), because that's the reason why I created a GUI window.


When the application starts in server mode, then the window that asks the user to enter database location and port number is displayed. The properties provided by the user are saved, the server is started and the configuration window is closed. The server has a startServer(int, String) method that deals with the Data class, binds the Server object to the Registry and adds a shutdownHook to the Runtime.getRuntime().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic