[jboss-user] [Remoting] - Re: timeout specification

ron.sigal@jboss.com do-not-reply at jboss.com
Thu Mar 22 15:48:33 EDT 2007


I just did an experiment in which I set the client's timeout to 1 second and pulled the ethernet plug out of the server machine.  I'm using the socket transport, by the way.  It took 30 seconds to get a timeout exception.  What's happening is that the socket client invoker tries multiple times (30 by default) to get a connection, and each connection timed out after 1 second.  The number of attempts can be configured by setting the numberOfRetries parameter.

Similarly, (also in the socket transport) if a connection has been established and then fails during the invocation, the invocation will be retried (3 times by default).  The number of retries can be configured by setting the numberOfCallRetries parameter.

You might be experiencing something like this.  See what happens if you run the client with the log level for org.jboss.remoting loggers set to DEBUG.

By the way, my client was on a Windows machine and my server was on a linux machine.  Java sockets depend on the underlying operating system, and it's just a fact that different environments handle this problem differently.  If you have the misfortune to be working in an environment that doesn't give you the support you need, you may have to handle the "unplugged cable" problem at the application level.  Just to see that you're not alone, take a look at 

http://forum.java.sun.com/thread.jspa?threadID=316842&messageID=1604338

A couple of strategies come to mind.  The forum suggests pinging on the connection to see if it's alive, and Remoting can help you with that.  Read about leasing and connection validation in Chapter 8 of the Remoting documentation:

http://labs.jboss.com/portal/jbossremoting/docs/guide/chapter-connection-failure.html

Another possibility would be to put the invocation in a separate thread t, and then, in your main thread, call t.join(timeout).  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030801#4030801

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030801



More information about the jboss-user mailing list