This is related to another question about system properties. In that question, I make the offhand comment:
It seems to me you'd need to send a UNIX signal (SIGINT maybe?) to Open Liberty to cause it to restart.
I am breaking this comment out into its own top-level question, which I will more formally state now.
I have a customer running Liberty on Kubernetes (Azure Kuberenetes service). They would like to have a technique that has the same effect as when you are running liberty:dev from the liberty-maven-plugin and one of the changes listed in Detect, recompile, and deploy code changes happens. They would like this technique to be arbitrarily triggerable at a time of their choosing. Currently they are implementing this with a kubernetes pod restart, but they want something less obtrusive.
If they just want to restart an application at an arbitrary time without restarting the pod, the best way would probably be to use the ApplicationMBean. They would need to enable the restConnector-2.0 feature and expose the port. They would also need to configure application updates using the following in server.xml:
<applicationMonitor updateTrigger="mbean"/>
This will disable dynamic updates of the application unless they explicitly invoke the restart()
method on the mbean.
This would not be the recommended approach -- generally in a kubernetes environment you would want to replace the existing pod. But, this will work if they need it.
If they want to restart the entire server, they could exec into the pod and use the server script to stop and start the server. Again, this would not be a recommended approach.