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:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to