Atharva
Atharva

Reputation: 6969

How to easily maintain the RMI interfaces across multiple applications like server and client?

Any one dealing with the RMI would certainly have come across this dilemma of how to easily maintain the interfaces to objects providing remote method invocation service to other client applications. Whenever we decide to have a minor change in the method declaration or adding/deleting methods declared in the interface, we have to manually replicate the change in all the clients that would be using that interface for accessing RMI service from a remote server.

Upvotes: 1

Views: 869

Answers (2)

user207421
user207421

Reputation: 310874

Think about having a downloadable (Serializable) agent that has a more stable interface used by the client, and that uses the remote interface to do its job. You can use the codebase feature to ensure its availability to all clients. The agent needs to contain the stub. You can bind the agent to the Registry, or return it from some other remote method.

Or, use JWS to distribute new versions of the clients.

Or, design your remote interfaces more stably so they don't have to change -:)

Upvotes: 1

Atharva
Atharva

Reputation: 6969

One of the good workaround I came up with is to

  1. put all the interfaces provided by the RMI server in a separate project which will pack itself into a jar file when built.
  2. Then just add that jar file as dependency or in the classpath of the server application which is meant to provide the RMI service as well as to any of the client applications that want to use those interfaces for invoking remote methods.

This will ease the task of maintaining RMI interfaces by updating them at just one place. Extra effort of changing method signature in some interface will be limited to changing the application code which calls that method.

Upvotes: 0

Related Questions