I need to share server sockets for the RMI objects I create
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Paul_Beadle
Posted On:   Monday, July 23, 2001 09:02 AM

I have a Java app which uses RMI calls on bound interfaces to create remoteable objects. This works fine. I call my create object method on an interface in the RMIRegistry created with Naming.Rebind , and the created object is also derived from UnicastRemoteObject so it's interface can be used directly by the client. Now, I want to use SSL, so I created server and client socket factories and in the constructors for all objects derived from UnicastRemoteObject , I call: super(0, new ClientSocketFactory(protocolname), new ServerSocketFactory(protocolname)); Because I create a lot of these objects, I get a lot of server sockets created - even some I don't use if I happen to create an object for   More>>

I have a Java app which uses RMI calls on bound interfaces to create remoteable objects. This works fine. I call my create object method on an interface in the RMIRegistry created with Naming.Rebind , and the created object is also derived from UnicastRemoteObject so it's interface can be used directly by the client.


Now, I want to use SSL, so I created server and client socket factories and in the constructors for all objects derived from UnicastRemoteObject , I call:

			
super(0, new ClientSocketFactory(protocolname), new ServerSocketFactory(protocolname));

Because I create a lot of these objects, I get a lot of server sockets created - even some I don't use if I happen to create an object for use in the server or client internally. When not using the socket factories, the Java RMI code internally shares its server port so that only one gets created. How can I do this myself with my own SSL sockets? I tried creating just one socket and having the socket factory return that one all the time, but I get a java.rmi.NoSuchObjectException on the client because the server doesn't know about the object after I created it. Is there a way of telling the RMI system that I want to create my own server sockets but want to share them?    <<Less
About | Sitemap | Contact