-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: AuditInterceptor ConcurrentModificationException
PostPosted: Tue Jun 12, 2007 5:10 am 
Newbie

Joined: Tue Jun 12, 2007 4:59 am
Posts: 4
Hi,
We`re using an AuditInterceptor based on http://www.hibernate.org/318.html
in hibernate version 3.2.1.ga.
The problem is the postFlush method in the AuditInterceptor is throwing a ConcurrentModificationException when we try to access the Iterator which is passed into the postFlush method.

Code:
public void postFlush(Iterator it) throws CallbackException {
            
       Session session = sessionFactory.openSession();
   
    while(it.hasNext()) {
       Object obj = it.next();
             //DO STUFF
        }
}

The Object obj = it.next(); is throwing the ConcurrentModificationException.

We`re using the AuditInterceptor as a Singleton Spring bean as we were assuming that the Iterators passed in were thread safe which they don`t appear to be. Has anybody else experianced this problem and if so is there a way round it with out changing the Hibernate code?

Thanks

Darran


Top
 Profile  
 
 Post subject: Interceptor is not thread safe
PostPosted: Mon Jun 18, 2007 10:28 am 
Newbie

Joined: Tue Jun 12, 2007 4:59 am
Posts: 4
After removing some of the debug statements in the interceptor I no longer got this exception. It therefore appears the Interceptor is not Thread safe. This is due to the postFlush(Iterator it) having an iterator passed in which points to a container which is not threadsafe.


Top
 Profile  
 
 Post subject: Re: AuditInterceptor ConcurrentModificationException
PostPosted: Thu Sep 03, 2015 6:56 am 
Newbie

Joined: Tue Sep 01, 2015 7:21 am
Posts: 2
In my case i don't have any debug statements in the interceptor but I still get the ConcurrentModificationException. This seems to be an issue with the hibernate because the iterator is not thread safe. Is this fixed as part of any future releases? I am currently using hibernate-core-4.2.13.Final.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.