Hi
I am using RmiServiceExporter for RMI remoting on an application that needs to fail over.
When I pull the network cable out of the remote computer to test the failover, the call takes about a minute to fail with RemoteLookupFailureException (cause java.net.ConnectException: Connection timed out: connect)
Does anyone know a way to make it fail quicker than that?
The stack trace while it is waiting for the timeout is:
at java.net.SocketInputStream.socketRead0 ( Unknown source )
at java.net.SocketInputStream.read ( SocketInputStream.java:129 )
at java.io.BufferedInputStream.fill ( BufferedInputStream.java:218 )
at java.io.BufferedInputStream.read ( BufferedInputStream.java:235 )
at java.io.DataInputStream.readByte ( DataInputStream.java:241 )
at sun.rmi.transport.StreamRemoteCall.executeCall ( StreamRemoteCall.java:189 )
at sun.rmi.server.UnicastRef.invoke ( UnicastRef.java:126 )
at org.springframework.remoting.rmi.RmiInvocationWrap per_Stub.invoke ( Unknown source )
at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke ( RmiClientInterceptor.java:393 )
at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke ( RmiClientInterceptor.java:339 )
at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke ( RmiClientInterceptor.java:258 )
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed ( ReflectiveMethodInvocation.java:171 )
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke ( JdkDynamicAopProxy.java:204 )
at $Proxy63.getConfigurationDeltaUpdates ( Unknown source )
After the one minute timeout, I get:
org.springframework.remoting.RemoteLookupFailureEx ception: Lookup of RMI stub failed; nested exception is java.rmi.ConnectException: Connection refused to host: 192.168.110.207; nested exception is:
java.net.ConnectException: Connection timed out: connect
Caused by:
java.rmi.ConnectException: Connection refused to host: 192.168.110.207; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:574)
at sun.rmi.transport.tcp.TCPChannel.createConnection( TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCP Channel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java: 306)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at org.springframework.remoting.rmi.RmiClientIntercep tor.lookupStub(RmiClientInterceptor.java:199)
at org.springframework.remoting.rmi.RmiClientIntercep tor.refreshAndRetry(RmiClientInterceptor.java:320)
at org.springframework.remoting.rmi.RmiClientIntercep tor.handleRemoteConnectFailure(RmiClientIntercepto r.java:301)
at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:261)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy66.releaseAllForThread(Unknown Source)
I notice that it is possible for a timeout to be set on the socket classes but I can't work out how to influence that from my Spring config or anywhere else.
I thought about using this: http://forum.springframework.org/showthread.php?t=20127
...except that I only want a quick timeout in the cases where the host is unreachable. At other times, remote calls may legitimately take several minutes.
Any help would be much appreciated. Thanks
Paul.


Reply With Quote
