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" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> 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
> [EMAIL PROTECTED]
> Cel.: (51)91287530
> Linux Counter #281893
>
> Faculdade Ritter dos Reis
> www.ritterdosreis.br
> [EMAIL PROTECTED]
> Fone/Fax.: (51)32303328
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893
Faculdade Ritter dos Reis
www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303328
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>