A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Concurrent Modification Exception in sessiontime out class
shashi wagh
Ranch Hand
Joined: Oct 30, 2008
Posts: 38
posted
Nov 13, 2008 21:38:00
0
Hi
I want to remove some attribute from the
ServletContext
when session time out
I am getting
java.util.ConcurrentModificationException
Exception for the following code
public class SessionTimeOutListener implements HttpSessionListener { public void sessionCreated( HttpSessionEvent httpSessionEvent ){} public synchronized void sessionDestroyed( HttpSessionEvent httpSessionEvent ){ HttpSession httpSession = httpSessionEvent.getSession(); ServletContext context = httpSession.getServletContext(); UserProfileVO userProfileVO = (UserProfileVO)httpSession.getAttribute( CrmwConstant.USER_PROFILE ); Map< String, String > mapBookingLock = (Map< String, String> :wink: context .getAttribute(CrmwConstant.BOOKING_LOCK_MAP ); if ( mapBookingLock != null ) { Set setBooking = mapBookingLock.entrySet(); for ( Iterator iterator = setBooking.iterator();iterator.hasNext(); ) { Map.Entry pairs = (Map.Entry)iterator.next(); // Exception on this line String key = (String)pairs.getKey(); String value = (String)pairs.getValue(); if ( value.equals( ( CRMWUtility.getFullName( userProfileVO.getPrfx(), userProfileVO.getFirstName(), userProfileVO.getMiddleName(), userProfileVO.getLastName() ) ) ) ) { mapBookingLock.remove( key ); } } context.setAttribute( CrmwConstant.BOOKING_LOCK_MAP, mapBookingLock ); } } }
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Nov 13, 2008 21:59:00
0
Shouldn't this be in the
servlets
forum?
It's also helpful to provide information like which specific line is throwing the exception and so on.
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
1
I like...
posted
Nov 13, 2008 21:59:00
0
When I
googled
this exception , I found many links which discuss this particular problem..
This
one might helps you in understand the problem..
[LEARNING bLOG]
|
[Freelance Web Designer]
|
[and "Rohan" is part of my surname]
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Concurrent Modification Exception in sessiontime out class
Similar Threads
destroy sessionContext from EJB?
Map.Entry
Invalidating all sessions
Get session object from session ID
Why are Generics necessary here?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter