Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use RMI bidirectional between two classes?

I want to share some information between two classes (A and B), which are running in different java programs. Instead of writing a whole communication protocol I want to use the java build-in rmi classes for that purpose. Currently class B is able to run a method which belongs to class A remotely. Is it somehow possible to use the same "connection" within class A to call a method of class B? Otherwise I probably have to implement a second rmi service ...

BR,

Markus

like image 693
Markus Avatar asked May 26 '09 17:05

Markus


1 Answers

If B implements Remote, it can be export and passed as a parameter in an RMI call to A. In this scenario, there's no need to register B in an RMI registry, since the client is being passed a reference to it explicitly.

like image 65
erickson Avatar answered Sep 23 '22 09:09

erickson