directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Burmester <>
Subject Suggestions on implementing timeouts?
Date Thu, 14 Jul 2005 23:01:24 GMT
Hi all, 

I have a protocol router built on top of mina.  One thing I am having 
issues with is my timeout cleanup code causing the occasional 
ConcurrentModificationException when under heavy load.

I have a hash of connections and each has a hash of outstanding messages.
Every so often a synchronized cleanup method is run that iterates over all 
the connections and all the outstanding messages and cleans up any stale 
messages.  I think the issue is that even though the individual HashMaps 
are wrapped as synchronizedMaps (I probably should update to 
ConcurrentHashMap) However I think I missed something because it appears 
that under load, once in a while one of the maps is still able to get 
modified by another thread while the cleanup iterators are open.

I'm thinking maybe it might be best to change my timeout strategy.  
Perhaps I should be registering a timeout event with an event queue
for each message, although this seems like a lot of overhead for something 
that is supposed to be quick and lite.  

Anyone have any suggestions for implementing timeouts without blocking all 
other threads during the cleanup scans?



View raw message