File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes Inter-process communication between two JVMs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Inter-process communication between two JVMs" Watch "Inter-process communication between two JVMs" New topic
Author

Inter-process communication between two JVMs

Michael Andro
Greenhorn

Joined: Sep 20, 2010
Posts: 9
Hey there,

I want two JVMs to communicate with each other. I got some suggestions on this topic, however, I am not absolutely sure what to use. The communication is quite simple, it is one JVM running the web application with Tomcat and one JVM is the backend system calculating some stuff. Now I want to use the web application to invoke the calculation to start on the other JVM. It is quite simple, and there is mere information to exchange.

RMI seems a bit overpowered for this task. The suggesstion was JMS and sockets so far. But on what base should I decide which to use?

Best regards,
Michael
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
What are the requirements? JMS is asynchronous (and implies the existence of a messaging server), while sockets work synchronously - it's hard to picture a scenario where both approaches are equally adequate.


Ping & DNS - updated with new look and Ping home screen widget
Michael Andro
Greenhorn

Joined: Sep 20, 2010
Posts: 9
Yes, I see the difference. These requirements were not considered yet. Maybe the backend system should run some request which were invoked by the web application.

So, what I say, the possibility is there, that the backend system is running an algorithm, meanwhile the web application sends a new request, which has to be dealt with. This is what I understand to asynchronrous communication, request are invoked even so the backend system is not listening at the moment.

However, I don't see the point how this cannot be realizes with a socket through concurrent execution.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
The web app could certainly use a socket to shoot the request to the app server, then close the socket after it got some kind of ID from the app server, and finally -some time later, most likely as part of a different request it is serving- re-contact the app server with the ID to find out if the results are in. That would make the communication sort of asynchronous.
Michael Andro
Greenhorn

Joined: Sep 20, 2010
Posts: 9
Okay, I will go for sockets. Do I have to connect/listen the socket to localhost/127.0.0.1 or is there an alternative path suggested?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inter-process communication between two JVMs
 
Similar Threads
JDK 1.3 vs JDK 1.2.2_007?
Choosing a server-side Linux VM
about implicit objects
JVM to JVM Communication
Detecting another running JVM from a JVM!