hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück <...@odi.ch>
Subject Re: session not closed tomcat's manager
Date Fri, 26 Aug 2005 15:52:45 GMT
Eric,

client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
 > )).setConnectionTimeout(1);

This line pops a new connection from the connection manager. Don't do 
that! You will disrupt connection management like this.

A new session in Tomcat is openend as soon as a new connection is 
established to the server without a valid session cookie. This session 
will remain until you explicitly invalidate it or it times out. The 
session will survive a closed connection of course. Once again: You can 
not control session lifecycle from the client. Connection timeout has 
nothing to do with session timeout.

Ortwin Glück

Eric Portalez wrote:
> Thank you.
> 
> I call HttpMethod.releaseConnection, indeed.
> 
> You perfectly right about my intention : destroy the opened session on my
> server.
> My problem is that I have to fix the timeout at 2 hours (I can't explain why
> here, it would be too long).
> But, in some cases, I don't want my session exist too long.
> 
> The line
> client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
> )).setConnectionTimeout(1);
> is not taken into account, maybe because I have to call it before the call
> of the executeMethod() ?
> 
> I will do some tests.
> 
> If you have any others suggestions, I would appreciate them.
> 
> Thanks.
> 
> Eric Portalez.
> 
> ----- Original Message ----- 
> From: "Ortwin Glück" <odi@odi.ch>
> To: "HttpClient Project" <httpclient-dev@jakarta.apache.org>
> Sent: Friday, August 26, 2005 5:30 PM
> Subject: Re: session not closed tomcat's manager
> 
> 
> Eric,
> 
> this code looks funny - and is completely useless. Remove it.
> All you have to do is call HttpMethod.releaseConnection.
> 
> You are trying to destroy a server-side session from the client side.
> This is simply impossible. Your *webapplication* has to destroy the
> session with a call to HttpSession.invalidate(). Or you can simply wait
> until it expires. Default timeout is something like 30 minutes or so.
> Normally a session is destroyed upon "logout" from the webapp. How that
> happens is not standardized and depends completely on the concrete
> implementation.
> 
> Ortwin Glück
> 
> Eric Portalez wrote:
> 
>>Hello,
>>
>>I'm trying to terminate properly my session, but I don't manage.
>>
>>Here my code :
>>
>>public void closeSession() throws IOException{
>>  if(client != null){
>>
> 
> client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
> )).setConnectionTimeout(1);
> 
> client.getHttpConnectionManager().releaseConnection(client.getHttpConnection
> Manager().getConnection(client.getHostConfiguration()));
> 
> client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
> )).close();
> 
>>   client.setConnectionTimeout(1);
>>   client = null;
>>  }
>>}
>>
>>
>>I've tried differents combinations without any success. My manager in
> 
> tomcat always shows me that the session is opende.
> 
>>I precise that my session disapear correctly at the end of the timeout.
>>
>>
>>Any ideas ?
>>
>>Thanks.
>>
>>
>>Eric Portalez
>>
>>
> 
> 

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416

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


Mime
View raw message