Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I change the SocketFactory at runtime?  RSS feed

 
Marek Berkan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
I have a question, maybe someone has had a similar problem. I have a client-server application with communication over RMI. The client may, through a dialog box, choose a connection "submethod":
* a simple RMI
* RMI over fixed ports
* RMI over HTTP.
After selection the application registers the proper socket factory with the RMISocketFactory.setSocketFactory(...) method. So, if the user disconnects from the server and tries to reconnect with another "submethod", the application throws the following exception:

API says "The RMI socket factory can only be set once", so how can I change the connection submethod at runtime?
Regards,
Marek.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do believe you're answering your own question. Once the factory is set, it's set. Your alternative is to restart the server side as well.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!