Hello,

I am calling closeIdleConnections () on ThreadSafeClientConnManager object
every time a method is executed.

However I am ending up with a lot of connections in CLOSE_WAIT state for
long time. What can I do to ensure that these are closed?

Thanks.

Mugoma Joseph.

------------------

SAMPLE CODE:



        private static ThreadSafeClientConnManager connectionManager = null;
        private static final long MAX_CONNECTION_IDLE_TIME = 60000; // 
milliseconds

        static {
    connectionManager = new ThreadSafeClientConnManager();
    connectionManager.setDefaultMaxPerRoute(1000);
    connectionManager.setMaxTotal(1000);
    httpClient = new DefaultHttpClient(connectionManager);

        }

Then:


        /*
        * Check URL
        */
        public void getObject(String url) throws Exception {

                try {

                }

                catch (java.io.InvalidClassException except) {

                }

                catch (IOException except) {
                  except.printStackTrace();
                        throw except;
                }
                finally {
                  //IOUtils.closeQuietly(oin);

                  //getMethod.releaseConnection();
                  
//connectionManager.closeIdleConnections(MAX_CONNECTION_IDLE_TIME);
                        
connectionManager.closeIdleConnections(MAX_CONNECTION_IDLE_TIME,
TimeUnit.MILLISECONDS);
                        connectionManager.closeExpiredConnections();
                }


        }






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to