Tomcat通过JMX重新启动

Tomcat通过JMX重新启动

本文介绍了Tomcat通过JMX重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过JMX重新启动tomcat? tomcat是否有任何支持重新启动其所有应用程序和服务的mbean?

Is it possible to restart tomcat via JMX? Does tomcat has any mbean that supports restart of all its apps and services?

推荐答案

据我所知,没有特定的功能可以执行此操作.但是,您可以安装一个自定义MBean,它将调用:

So far as I know, there is no specific functionality to do this. However, you can install a custom MBean which will call :

public static final int RESTART_EXIT_CODE = -999;
....
java.lang.System.exit(RESTART_EXIT_CODE);

然后修改启动Tomcat服务的命令文件,以检查JVM进程的退出代码,如果它等于RESTART_EXIT_CODE,则重新调用该命令文件.

Then modify the command file that starts the Tomcat service to check the exit code of the JVM process, and if it is equal to the RESTART_EXIT_CODE, then re-invoke the command file.

这篇关于Tomcat通过JMX重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:50