Reputation: 5398
if we are to have an RMI server application which runs permanently via autosys and then shuts down for a few hours over night, how to we send the shutdown message if the application was started from the command line.
for example, we start the jar using java -jar server.jar
and now the application is running. if it contained a applicationClose()
method how could we call it - we could parse the message from the client but of course this is undesirable?
Upvotes: 0
Views: 305
Reputation: 5122
It is perfectly acceptable to make a closedown request method available, that returns OK and then calls System.exit()
.
You might want to protect it with some sort of required credentials before it can be called, but other than that there is no reason why you can't.
The other option is for the process to have another TCP port open with your own protocol for shutting down, or to have a JMX extension installed to remotely shut down the service.
Upvotes: 1