Biscuit128
Biscuit128

Reputation: 5398

How to exit rmi server application

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

Answers (1)

Chris Cooper
Chris Cooper

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

Related Questions