Is there a way to completely disable RMI in a java application?

青春壹個敷衍的年華 提交于 2019-12-22 10:54:05

问题


In our application remote Procedure call is solved with an own netty based command dispatcher system. We have a lot of modules (about 20) and I want to run all modules in separate jvm-s. My problem is, that RMI spawns about 17 threads for each JVM. I do not need RMI at all (as far as I know).

Can I completely disable RMI for a jvm? Or at least configure it in a way that it does not use this many threads?


回答1:


StuartMarks is correct. RMI doesn't start any threads until you use it.

Possibly you are using it in some way of which you are unaware, e.g. JMX?




回答2:


You are most likely looking at your JVMs with a monitoring application, right? Well: these monitoring applications use RMI. So you will see always RMI threads within your monitoring application, profiler, etc. And you will always see them using some amount of CPU time. Just as gathering profiling information does not work without transporting these information (via RMI) to your tool. You can implement your own transportation protocol and direct the management beans to use it but I doubt that you can save enough resources to return your development costs.

If you don’t use any RMI, RMI won’t start any threads. But if you are using it, even if you aren’t aware of this, disabling RMI implies that your software will not work any more.



来源:https://stackoverflow.com/questions/19180161/is-there-a-way-to-completely-disable-rmi-in-a-java-application

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