> Yes I am. In finally{} block. Here is the client code:

Calling the disconnect() method of HttpURLConnection may close the
underlying socket
if a persistent connection is otherwise idle at that time
Try don't call it,  test it and tell us :-)

http://docs.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html


>
>    private Properties push(final Properties request) throws IOException {
>        HttpURLConnection connection = null;
>        PrintStream out = null;
>        InputStream in = null;
>        try {
>            connection = (HttpURLConnection) pushUrl.openConnection(proxy);
>            connection.setRequestMethod("POST");
>            connection.setDoOutput(true);
>            connection.setConnectTimeout(TWO_MINUTES);
>            connection.setReadTimeout(TWO_MINUTES);
>            connection.setRequestProperty("Connection", "close");
>
>            out = new PrintStream(connection.getOutputStream());
>            request.storeToXML(out, null);
>            out.flush();
>
>            in = connection.getInputStream();
>            final Properties response = new Properties();
>            response.loadFromXML(in);
>
>            return response;
>        } finally {
>            if (in != null) {
>                try {
>                    in.close();
>                } catch (Exception e) {
>                    // ignore...
>                }
>            }
>            if (out != null) {
>                try {
>                    out.close();
>                } catch (Exception e) {
>                    // ignore...
>                }
>            }
>
>            if (connection != null) {
>                try {
>                    connection.disconnect();
>                } catch (Exception e) {
>                    // ignore...
>                }
>            }
>        }
>    }
> }
>
> --
> Kees Jan
>
> http://java-monitor.com/
> kjkos...@kjkoster.org
> +31651838192
>
> Human beings make life so interesting. Do you know that in a universe so full 
> of wonders,
> they have managed to invent boredom. Quite astonishing... -- Terry Pratchett
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to