Sobvan
Sobvan

Reputation: 1402

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

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?

Upvotes: 4

Views: 5128

Answers (2)

user207421
user207421

Reputation: 310980

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?

Upvotes: 3

Holger
Holger

Reputation: 298419

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.

Upvotes: 6

Related Questions