Hi,
How can two/multiple JVMs running in a same machine communicate without RMI?.
Thx
Hi,
How can two/multiple JVMs running in a same machine communicate without RMI?.
Thx
sockets, remote EJB, web services ... from the top of my head. What is your specific case?
Communicate or invoke methods?
You could always open sockets and communicate directly via an arbitrary protocol, or even pass objects back and forth in serialized forms. On most operating systems, socket connections between processes on the same machine are faster and more efficient than connections between machines.
A good place to start would be to look at a JMS tutrial. JMS requires an extra broker process, but makes communication between JVMs a piece of cake.
There are also things like J2EE and even http based XML-RPC but these might be overkill for your needs.
If you are concerned about the security of JVM to JVM communication against snooping with Wireshark, etc, you could consider doing your RMI communication over an SSL secured channel, or the equivalent.
However, if someone is able to run Wireshark on the same machine as your two JVMs, this probably not be sufficient to solve your problems. And using an alternative to RMI is not going to make you more secure either.
For a start, if the bad guys have sufficient privilege to run Wireshark, they almost certainly have the privilege to interfere with the JVMs in ways that would subvert your use of a secured channel. For example, they could probably attach a debugger to the JVMs, or hack the application code (via the file system) to leak the information you are trying to protect.
In short, you would be better off just using RMI, and spending your time making sure that the bad guys cannot get into your machine to run Wireshark (etc) in the first place.