You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by ne...@sonic.net on 2004/08/02 20:48:42 UTC

Re: Slide Client opening too many connections

> Ideally, if we are not overlapping operations, there should be only one
> open connection. So we don't worry about having to close it.

Except if the client is communicating with hundreds of different servers -
then it is not acceptable to have the connections left open, because the
client may run out of file descriptors (I have seen this). We would rather
have control over when to close the connections from the application code.
The overhead of reopening a connection is not too bad because we are
dealing with PUTting large files.

Neil



> Yes, the close method should really close the connection.
>
> But as you said, explicity closing the connection will require opening a
> new connection for each method which may incur in some performance.
> Instead, why don't we let the ConnectionManager do its job on reusing
> connections keeping the number of open connections to a minimum.
> Ideally, if we are not overlapping operations, there should be only one
> open connection. So we don't worry about having to close it.
>
> Actually, I've been working on a filesystem for NetBeans and I wanted my
> whole filesystem to share only one connection with each FileObject using
> a WebdavResource instance. I wasn't sure if a FileObject would be
> accessed simultaneously by different threads in Netbeans so I modified
> WebdavResource as explained earlier.  Actually the deadlock problems I
> was having may have not been related to WebdavResource but anyway I
> using that way now and I haven't noticed any problems but I haven't
> validated that actually works as expected.
>
> I can provide a patch if interested but I need to update it against the
> latest version from CVS.
>
> Carlos
>
>
> Ingo Brunberg wrote:
>
>>Of course this will work, and I have metioned this possibility many
>>times. But it will not physically close the connection either. Calling
>>releaseConnection() just makes sure that the connection can be safely
>>reused.
>>
>>Ingo
>>
>>
>>
>>>How about using the MultiThreadedHttpConnectionManager and then calling
>>>method.releaseConnection()  after executing each method in
>>> WebdavResource.
>>>
>>>For example, a typical fragment in WebdavResource:
>>>
>>>        int statusCode;
>>>        try {
>>>            statusCode = client.executeMethod(method);
>>>        } finally {
>>>            method.releaseConnection();
>>>        }
>>>        setStatusCode(statusCode);
>>>        return (statusCode >= 200 && statusCode < 300) ? true : false;
>>>}
>>>
>>>Will this work?
>>>
>>>Carlos
>>>
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org