telebog
telebog

Reputation: 1896

What is the proper way of using RMI remote objects on the client side?

In a dialog (window) let suppose we have some buttons and when a button is pressed a remote method invocation take place.

How it is better:

Upvotes: 1

Views: 125

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

Just do your lookup once, and cache the reference to the remote object somewhere. The rmiregistry is just used for bootstrapping. Doing a lookup every time will cause lots of unnecessary network calls.

The ServiceLocator pattern talks about it:

The Service Locator pattern centralizes distributed service object lookups, provides a centralized point of control, and may act as a cache that eliminates redundant lookups.

Upvotes: 4

Related Questions