title: JMX Connection time out
body: <p><strong>My Thread pool is becoming full because, most of the threads are waiting for the socket connection. How to add timeout for jmx connect</strong> </p>
  
  <pre><code>java.lang.Thread.State: RUNNABLE
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      - locked &lt;0x05671ad0&gt; (a java.net.SocksSocketImpl)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      at java.net.Socket.connect(Socket.java:519)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:548)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.&lt;init&gt;(SSLSocketImpl.java:351)
      at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:71)
      at javax.rmi.ssl.SslRMIClientSocketFactory.createSocket(SslRMIClientSocketFactory.java:105)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
      at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
      at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
      at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
      at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1871)
      at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1841)
      at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
  </code></pre>