My application is running on tomcat with Spring and Hibernate framework. It use EHCache as a cache provider in service level. That means objects created by service classes put in to the cache. (Not hibernate Dao objects).
There are some collection objects (HashSet, ArrayList, HashMap) in these cached objects. Non of them are syncronized collections. All are not thread safe, but not modify by the application after put in to the cache.
I found infinite loop in many ocations when I loop through this collection. Some of the loops are Iterator loops and some others are old for loops run base on int index.
I mannaged to overcome one infinite loop by replasing a HashSet with Collections.synchronizedSet(new HashSet()). But I don't understand the real problem of using normal HashSet as it's never being modified by the application. (Does EHCache modify them?)
Please explain me if there are any concerns here using non-thread safe collections.
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!