Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI timeout

 
Yemi Dalley
Greenhorn
Posts: 12
MyEclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I'm rounding off my URLyBird assignment but i've noticed that the client just waits forever whenever the server is no longer unavailable. Is there a way to set a time out, after which the proxy throws an appropriate exception ?

Thanks
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm at work and can't try it.. but you got me thinking and wanted to know for myself, and I found this :

RMI Naming.loookup timeouts

Could you please tell me if that solved the problem ?

Regards,
Alex
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alex Belisle Turcot:

RMI Naming.loookup timeouts


I dont think Naming.lookup will hang forever if the server is not available.
If i understand you correctly, then what you require is that if a method call does not complete within a stipulated time period, it should throw an exception. If this is what you are referring to then, you need to write your own RmiClientSocketFactory and set the socket timeout to a desired value for every socket created.
The following code may help:



This link will also help.
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Although this sounds very interesting but don't you think that this is not part of the requirements.
if it not part of the your requirements consider my humble advice of leaving this part till the end after you make sure that everything required is working perfectly.
 
Yemi Dalley
Greenhorn
Posts: 12
MyEclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys ;
It's very interesting indeed ..
my problem was because i didn't unexportObject the remote object , i only called unbind.

After calling unexportObject the default timeout seems to be ok.
 
Fors Judd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the careful and complete piece of code.
But due to my own mountainous confusion, I do not see when or where to use this thing.

Nitesh Kant wrote:
public class ClientSocketFactory implements RMIClientSocketFactory, Serializable { ... }


Must it happen before the UnicastRemoteObject gets constructed? or after?
just once? or as often as you like?
How does it relate to RMISocketFactory? Does it get bundled up and handed off to setSocketFactory somehow?
And does this solution pertain only to certain versions of Java?
 
Fors Judd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note that both these links are dead:
"RMI Naming.loookup timeouts"
"This link will also help."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic