Is it possible to programmatically close a Java process through JMX

不打扰是莪最后的温柔 提交于 2019-12-04 04:35:46

Sure. Implement an MBean on the target server that calls System.exit(), and invoke that as a JMX operation from the client.

If you're using Spring, you can simply annotate your bean to have one of its operations being exposed as an MBean operation. So it would be something like this:

@MBeanOperation(description="Kill the service")
public void die() {
  System.exit();
}

... or perhaps stop the application context yourself.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!