Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] ConcurrentModificationException

Hi all,
I got a ConcurrentModificationException using an aspect but I don't understand 
why. This is the situation: I've got a  LazyLoadingCache object (singleton) 
that thru a few synchronized methods allows the insertion/deletion of entries 
in the cache. The cache internally uses a HashMap to store the information.

Then I've got the following pointcut:

pointcut emptyLazyLoadingCache() :  
(execution( public static  List 
g2.database.mapping.*.loadAll(ProgressObserver) throws DatabaseException )
||
execution( protected ListTableModel 
g2.gui.workers.TableSwingWorker.doInBackground() throws Exception )
)
&&
(! cflow(adviceexecution()) ) 
;

that catches when a "loadAll" action is issued. The aim is to reset the cache 
for a complete reload of the data. To achieve this, the following advice is 
defined:

before() : emptyLazyLoadingCache(){

	Class ownerClass = ...
       ....
	// empty the cache
	int refactor = this.llCache.emptyCacheForClass( ownerClass );
    }

where llCache is the singleton instance of the cache, and the 
emptyCacheForClas method is a synchronized method that performs a remove on 
the hashmap. However, I got the above exception, and I've checked printing the 
thread ids and each time the thread is always the same (that is a 
SwingWorker). Any idea about where and how to investigate?


Thanks,
Luca


Back to the top