views:

66

answers:

1

I have two application which communicates by using RMI objects. I do have an interface, an implementation class and the generated stub class.

I recognized, that some changes in the impl class take me to create a new stub class.

My question is, what changes i can make without re-compiling the stub again?

As far as What i know:

  • I can not change the method structure (add,remove,change methods)
  • Can i add serialVersionUID to classes the impl class is using?
  • Can i change classes the impl class is using?
  • Can i document the impl and all used classes?

I ask this question, because i did a change at the beginning of this week and now, the RMI connection is broken. But i only add comments and updated my checkstyle. So i add serial version UIDs and changed some classes to be final.

Thanks for your answers.

+2  A: 

You only need to rerun rmic and generate your deployment classes if you change any method signature, including adding and deleting. The generated code simply links a remote invocation object to the actual implementation via the defined methods for the class.

This means you can change the impl code (except method signatures) and the code of any class used by the impl class without issue. If those classes used by the implementation are also part of your method signature, then proper versions will be required on the client side to match the remote implementation, but this is nothing RMI specific.

Robin