开发者

Single RMI stub vs many

开发者 https://www.devze.com 2023-02-14 14:32 出处:网络
I did not find good answer to this so decided to post. What is the best strategy to use RMI, in terms of number of stubs?

I did not find good answer to this so decided to post. What is the best strategy to use RMI, in terms of number of stubs?

a) one client stub used by many concurrent threads b) stub per interaction(ie. each thread has it开发者_如何学JAVAs own stub)


RMI stubs are thread-safe. There is no advantage to acquiring many copies of the same stub, and a considerable performance penalty.

In fact there is really no such thing as 'a number of stubs'. All stubs to the same remote object are logically and functionally equivalent. They even have the same hashcode, and are equal under equals().


You are probably going to call metods on stub .So use single stub and take care of shared resource on server side.

0

精彩评论

暂无评论...
验证码 换一张
取 消