Is it possible to use RMI bidirectional between two classes?

后端 未结 8 2007
慢半拍i
慢半拍i 2020-12-15 08:16

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

8条回答
  •  情书的邮戳
    2020-12-15 09:15

    It's been a while since I've used RMI, but IIRC if class B implements java.rmi.Remote and passes a reference to an instance of itself as a parameter to the method in class A, then class A should receive a stub and methods called on it will be called on the original instance.

    However, if you have a lot of such RMI calls going back anf fro, you will probably encounter performance problems.

提交回复
热议问题