Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 60895 invoked from network); 9 Apr 2003 08:10:50 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 9 Apr 2003 08:10:50 -0000 Received: (qmail 15643 invoked by uid 97); 9 Apr 2003 08:12:53 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 15636 invoked from network); 9 Apr 2003 08:12:52 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 9 Apr 2003 08:12:52 -0000 Received: (qmail 59449 invoked by uid 500); 9 Apr 2003 08:10:27 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 59438 invoked from network); 9 Apr 2003 08:10:26 -0000 Received: from line-zh-101-074.adsl.econophone.ch (HELO muon.mutsaers.com) (212.53.101.74) by daedalus.apache.org with SMTP; 9 Apr 2003 08:10:26 -0000 Received: by muon.mutsaers.com (Postfix, from userid 1000) id 1AB86E1FD; Wed, 9 Apr 2003 10:10:37 +0200 (CEST) To: "Tomcat Users List" Subject: HttpSession instance is differenct for each new request! From: Peter Mutsaers Date: 09 Apr 2003 10:10:37 +0200 In-Reply-To: Message-ID: <87llyk9jlu.fsf@muon.mutsaers.com> Lines: 29 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Until recently we used the session object in order to synchronize some blocks on: synchronized ( request.getSession() ) { ... } Yesterday I found out that each time you call request.getSession(), tomcat/catalina returns another instance of SessionFacade. Each instance represents the same session (getAttribute and getId return the same values each time) but still it is very unfortunate and questinable that a different object is returned each time (causing synchronization on the session object to break). Is this normal, should not the same object be returned every time? Has it maybe been fixed in newer tomcat versions (we are still using 4.0.3)? Now I have to go through great lengths in order to create a unique Object as session-attribute to synchronzie on instead: synchronized ( request.getSession().getAttribute("theSyncObject") ) Initially creating this attribute needs to be synchronized on the session as well, creating a chicken and egg problem :) Now I was forced to synchronize this step on the application (on some basic Class object). -- Peter Mutsaers, D�bendorf, Switzerland. --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org