tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike W-M" <m...@ward-murphy.co.uk>
Subject Re: HttpSession issues
Date Wed, 18 Dec 2002 11:32:37 GMT
Also (but not related to your problem) I think I noticed just the other day
that hitting return in the address bar isn't the same as hitting refresh,
because the browser can serve the page from the cache.
For what it's worth, you can have concurrent requests if they hit refresh
twice in quick succession (the browser just ignores the response to the
first one, I think).

Mike


----- Original Message -----
From: "Felipe Schnack" <felipes@ritterdosreis.br>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, December 18, 2002 11:12 AM
Subject: Re: HttpSession issues


  Yes, but this is related to an user session. How is possible to have
concurrent updates on an user session when an user have only one browser
window open and does a refresh? This iteration is done in a taglib. And
why this only happens when he refreshes the pages, but not when he hits
enter in the url bar?
  BTW, inside this loop in some circumstances I change the session
attributes. In other words, the code look like this:

Enumeration attrs = session.getAttributeNames();
while(attrs.hasMoreElements())
{
String name = (String)attrs.nextElement();
Object value = session.getAttribute(name);
if (<some weird conditions>)
{
session.removeAttribute(name);
}
}

  This removeAttribute() is the problem?

On Wed, 2002-12-18 at 00:18, Mike W-M wrote:
> This is nothing in particular to do with Tomcat, more with multi-threaded
> programming.
> The exception is used to indicate that whatever you've started iterating
> through has been changed in the meantime.
> The likely scenario here is that some other request is running at the same
> time as you're doing your looping and it's adding or deleting a session
> attribute.  Check the java.util javadocs for more info.
>
> I think the solution will be to synchronise the enumerating block of code,
> and all other blocks that modify the session attributes, on the session
> object.  It's generally good practice to minimise the amount of code that
> needs to be synchronised (and the time it takes) for performance reasons.
>
> Mike.
>
>
> ----- Original Message -----
> From: "Felipe Schnack" <felipes@ritterdosreis.br>
> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> Sent: Tuesday, December 17, 2002 9:12 PM
> Subject: HttpSession issues
>
>
>   There's something problematic about the Enumeration i get from
> HttpSession.getAttributeNames?
>   I have some situations in my application that I have to loop thru all
> my session attributes, but for some reason sometimes I get an
> "java.util.ConcurrentModificationException" then looping them...
>   The strangest thing is that a developer here get this error when he
> reloads a page, but it doesn't happen when he press enter in the URL
> bar... and this JSP file isn't the target of an HTML form... but
> receives parameters from the query string
>   I'm using JDK 1.4.1 and Tomcat 4.1.12
>
> --
>
> Felipe Schnack
> Analista de Sistemas
> felipes@ritterdosreis.br
> Cel.: (51)91287530
> Linux Counter #281893
>
> Faculdade Ritter dos Reis
> www.ritterdosreis.br
> felipes@ritterdosreis.br
> Fone/Fax.: (51)32303328
>
>
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
>
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
felipes@ritterdosreis.br
Fone/Fax.: (51)32303328


--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message