tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kent Kurima" <nws_61...@hotmail.com>
Subject Re: ConcurrentModificationException error (fixed) Thanks
Date Tue, 19 Feb 2002 17:42:26 GMT
Thanks to everyone.  Removing the session attributes after the
iteration worked.

Kent


>From: Simon Oldeboershuis <sol@outermedia.de>
>Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>To: Tomcat Users List <tomcat-user@jakarta.apache.org>
>Subject: Re: ConcurrentModificationException error
>Date: Tue, 19 Feb 2002 17:48:20 +0100
>
>Hi there,
>
>it is not allowed to modify any java collection/enumeration which is
>used for an iteration at the same time. Ralph is right, you have to copy
>the names and remove it after the iteration.
>
>simon
>
>
>Ralph Einfeldt schrieb:
> >
> > AFAIK that's a result of the way tomcat 4.x implements the internal
> > storage of the parameters. I think you can't remove a parameter inside
> > a loop whitch getParameterNames(). One way around that, is to collect
> > first the names and than remove the parameters.
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Eelco den Heijer [mailto:eelco@objectivation.com]
> > > Gesendet: Dienstag, 19. Februar 2002 17:00
> > > An: Tomcat Users List
> > > Betreff: Re: ConcurrentModificationException error
> > >
> > >
> > > Kent Kurima wrote:
> > > >
> > > > When I try to remove some information from the session I get a
> > > > ConcurrentModificationException error.
> > > >
> > > > tomcat 3.X did not have this problem, but tomcat 4.X is
> > > complaining about
> > > > this.
> > > >
> > > > here is a section of code that is having the problem
> > > >
> > > > java.util.Enumeration sessionNames = session.getAttributeNames();
> > > > while(sessionNames.hasMoreElements()){
> > > >         String lstrSessionName = (String)sessionNames.nextElement();
> > > >         if (!lvecTempVar.contains(lstrSessionName)) {
> > > >                 session.removeAttribute(lstrSessionName);
> > > >         }
> > >
> > > Hi Kent,
> > >
> > > Probably, another servlet instance is accessing that attr. of the
> > > session; you have to synchronize access to it:
> > >
> > > while(sessionNames.hasMoreElements()){
> > >         String lstrSessionName = (String)sessionNames.nextElement();
> > >         if (!lvecTempVar.contains(lstrSessionName)) {
> > >               synchronized (session) {
> > >                       session.removeAttribute(lstrSessionName);
> > >               }
> > >         }
> > >
> > > --
> > > To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > > For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> > > Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> > >
> > >
> > >
> >
> > --
> > To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> > Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>--
>Simon Oldeboershuis
>Entwicklung
>
>outermedia
>Internet Kommunikation
>Greifswalderstr. 207
>10405 Berlin
>Fon: 030- 4435 0943
>Fax: 030- 4435 0949
>sol@outermedia.de
>www.outermedia.de
>
>--
>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message