B4J Question Servers management

luke2012

Well-Known Member
Licensed User
Longtime User
Hi All,
I have two b4j web servers (CloudKVS & DataCollectionServer) running on a linux machine.
How to stop a specific server (for example started as "java -jar kvs_server.jar") and let the other server running ?
 

Roycefer

Well-Known Member
Licensed User
Longtime User
It can be helpful to print a program's process ID (PID) to the logs or to a file so that when it comes time to kill the program, you know which one to kill. The jAWTRobot library allows you to get the PID.

Another option is to enable console input with the jColorLogger library so that you can type commands into the terminal window and your program can respond accordingly. One of those commands can be "exit" and then your program can gracefully close, saving data and settings, closing ports, databases, etc... (rather than being unceremoniously killed by the task manager).
 
Upvote 0
Top