• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI DataSharing Issue Between JVMs

 
Billy Boy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am having problems setting a data share between JVMs using RMI. I am essentially passing Strings which are stored in a remote Queue.

I have get and set methods in a remote interface.

I then implement this interface with a queue which is wrapped by synchronized blocks.

I then launch the rmi registry and bind my object.

On the server and client I then lookup the remote object to get a "handle" to it. I then call sets and gets and expect the queue to contain everything set.

My queue is a static within the remote implementation.

My problem is when I run this in a single JVM I am getting all the messages. If run this in two JVMs I only get the messages I send from the same JVM. It seems each JVM has its own instance of the queue. I know I am deploying as this does not work unless I bind the remote object.

I use rmic to compile and create the stubs/skeletons.

What am I missing?

Thanks in advance.
 
Billy Boy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved!!

After writing my question, some of the discussions on this post set in and I solved my problem. I was not extending UnicastRemoteObject or exporting. I though the bind to the registry would handle this all for me.

I had tried this earlier but ran into exception when calling super in my constructor. I know use a super(port) and all works find.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!