Is it possible to use RMI bidirectional between two classes?

后端 未结 8 1985
慢半拍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:13

    How would class B know about class A without a second RMI server though? I think you are going to need two servers.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题