0 Replies Latest reply on Mar 20, 2013 10:48 AM by miragpl

    Connection Timeout setting

    miragpl Newbie

      Hi everyone,

       

       

      I'm getting problems with setting timeout for the socket connection while using hornetq with Netty. I'm setting up the connectionFactory the following way:

       

              Map<String, Object> connectionParams = new HashMap<String, Object>();

              connectionParams.put(TransportConstants.PORT_PROP_NAME, port);

              connectionParams.put(TransportConstants.HOST_PROP_NAME, ipaddress);

       

       

              TransportConfiguration transportConfiguration = new TransportConfiguration(

                      NettyConnectorFactory.class.getName(), connectionParams);

              HornetQConnectionFactory cf = (HornetQConnectionFactory) HornetQJMSClient

                      .createConnectionFactoryWithoutHA(JMSFactoryType.QUEUE_CF, transportConfiguration

       

      Then when I tries to connect i got sometimes an exception from line:

       


      at java.net.PlainSocketImpl.socketConnect(Native Method) [rt.jar:1.6.0_32]

      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) [rt.jar:1.6.0_32]

      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) [rt.jar:1.6.0_32]

      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) [rt.jar:1.6.0_32]

      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) [rt.jar:1.6.0_32]

      at java.net.Socket.connect(Socket.java:529) [rt.jar:1.6.0_32]

      at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.connect(OioClientSocketPipelineSink.java:114) [netty-3.2.6.Final.jar:]

      at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.eventSunk(OioClientSocketPipelineSink.java:74) [netty-3.2.6.Final.jar:]

      at org.jboss.netty.channel.Channels.connect(Channels.java:541) [netty-3.2.6.Final.jar:]

      at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:210) [netty-3.2.6.Final.jar:]

      at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:227) [netty-3.2.6.Final.jar:]

      at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:188) [netty-3.2.6.Final.jar:]

      at org.hornetq.core.remoting.impl.netty.NettyConnector.createConnection(NettyConnector.java:473) [hornetq-core-2.2.13.Final.jar:]

      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1143) [hornetq-core-2.2.13.Final.jar:]

       

      The connectionTimeout (10sek) used in socket connection is taken from ClientBootstrap from netty. How can I get an access to it during creation of the the hornetq connection factory?

       

      Thanks for advance,

      Marcin