1 Reply Latest reply on Jul 16, 2009 6:19 PM by ron_sigal

    Socket timeout exception handler

    suresh_muthu

      Is there a generic way to handle "Socket timed out" exception? Can we add a listener like JMS Exception listener? I see that SocketClientInvoker.handleException is handling the exception. Is there a way to add listener that gets notified on exceptions?

      Caused by: java.rmi.MarshalException: Socket timed out. Waited xxx milliseconds for response while calling on InvokerLocator [socket://x.x.x.x:xxxxx/?clientMaxPoolSize=xx&timeout=xxx&validatorPingPeriod=xxx&validatorPingTimeout=xxx]; nested exception is:
       java.net.SocketTimeoutException: Read timed out
       at org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker.java:118)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:689)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:133)
       at org.jboss.remoting.Client.invoke(Client.java:1640)
      
      


        • 1. Re: Socket timeout exception handler
          ron_sigal

          There's no built in listener facility (except in the context of callbacks from the server to the client).

          However, if you want to have some fun, you could write a custom SocketFactory that creates custom Sockets that return custom SocketInputStreams. You would want to configure the SocketFactory with a listener that can be called by the custom SocketInputStreams. To read about configuring Remoting with custom SocketFactories, take a look at Section "5.7. Socket factories and server socket factories" of the Remoting Guide at http://www.jboss.org/jbossremoting/docs/guide/2.5/html/index.html.

          How you would inject the listener into the SocketFactory depends on the context. If you're running in the Application Server, you could use MBeans (or POJOs if you're using AS 5). If you're running outside the AS, you could do it programmatically.

          If you like this idea and need more pointers, let me know.