Questions regarding creating my own RMI registry

M

Mark Chao

Hi all, recently I am trying to creating a presistent RMI registry by
implementing the java.RMI.registry interface. The registry keeps a
backup copy of all the binded objects. However, I realised that I have
no idea how to run it. Usually I just run the default RMIRegistry, by
typing RMIregistry in command prompt. However, how can I run this
registry that I have created, and use it across different JVM? I wonder
whether the LocateRegistry will work, and recognise my own registry.
Thanks if you can give me some hint.
 
T

Thomas Fritsch

Mark said:
Hi all, recently I am trying to creating a presistent RMI registry by
implementing the java.RMI.registry interface. The registry keeps a
backup copy of all the binded objects. However, I realised that I have
no idea how to run it. Usually I just run the default RMIRegistry, by
typing RMIregistry in command prompt. However, how can I run this
registry that I have created, and use it across different JVM? I wonder
whether the LocateRegistry will work, and recognise my own registry.
Thanks if you can give me some hint.
I guess you need the usual
public void main(String args[])
method. In this method you would create one instance of your registry
implementation, and then keep running forever. At least I think this is
what rmiregistry.exe (with class sun.rmi.registry.RegistryImpl) does.
 
E

E.J. Pitt

Mark said:
Hi all, recently I am trying to creating a presistent RMI registry by
implementing the java.RMI.registry interface. The registry keeps a
backup copy of all the binded objects. However, I realised that I have
no idea how to run it. Usually I just run the default RMIRegistry, by
typing RMIregistry in command prompt. However, how can I run this
registry that I have created, and use it across different JVM? I wonder
whether the LocateRegistry will work, and recognise my own registry.
Thanks if you can give me some hint.

Be warned that your Registry implementation won't work unless it extends
sun.rmi.server.RegistryImpl. Otherwise:

(a) it won't have the correct ObjectID
(b) the stubs synthesized by LocateRegistry.getRegistry (and used
internally by Naming) won't be able to talk to your registry
implementation and you will get protocol errors.

The alternative is to implement your own LocateRegistry but this is
non-trivial, as you still have to implement and know a fixed ObjectID
for a start. I don't know why you'd bother.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top