Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to comunicate between JVMs  RSS feed

 
upulig Malahotra
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Any know about a method to communicate between different JVMs ?
BR
upulig
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RMI is one way.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Tim says, RMI is one - in fact it seems to be the preferred method in J2EE and other systems where the JVM have to be closely coupled. RMI uses sockets to communicate but hides the details. You could always use sockets directly.
Perhaps if you describe the kind of communication you want to do you would get more details.
Bill
 
Jerome Lumpkin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RMI is probably the best way. However, do you need to communicate back and forth or only deliver a message to the other JVM?
[ February 19, 2002: Message edited by: Jerome Lumpkin ]
 
Venkatraman Balasubramanian
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If you need to have a loosely coupled communication, use JMS (provided the two JVMs host a JMS Service).
 
upulig Malahotra
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
Thank you so much for the information
I appreciate so much if i can get a code which describes about this particular thing.
Ex let's say I want call a method in a another JVM
how can i do that ?
Thank you so much your help.
BR
upulig
[ February 19, 2002: Message edited by: upulig Malahotra ]
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RMI stands for "Remote Method Invocation", so I'd say we're on the right track. JMS is more suitable for a looser coupling. For language-indedependent purposes there's also CORBA.
Briefly, to use RMI you prepare a remote stub and a local skeleton. The calling app will bind to the stub, the called class with build on the skeleton. The process of preparing everything is done with the RMI compiler (RMIC).
Once everything is assembled, the server registers itself with a naming service - which is port-based (generally port 1099) so that the client can find it. The actual process of calling a remote procedure consists of calling the stub, which causes the rmi port to be opened and the calling parameters to be serialized through the rmi channel. On the server side, the skeleton links to the actual method code, which does its work and returns its result (if any) to be serialized and sent back to the caller - again using a socket port.
An Enterprise JavaBean can also be used for this purpose - it's just an RMI implementation of a JavaBean with additional features such as transaction support builtin.
The RMI experts on JavaRanch hang out in the "Distributed Processing" forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!