db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: [RFC] Defensive copies on store/delete
Date Thu, 17 Apr 2003 20:48:08 GMT
hi leandro,

where do you make these copies ?

jakob

Leandro Rodrigo Saad Cruz wrote:

>Hi all.
>
>I'm trying to build a generic PersistenceManager using OJB and have
>thise issues !
>
>CONTEXT :
>
>I want my business object to be independent of the persistence api used,
>instead, I want them to implement BusinessObject that has the following
>methods :
>
>before/afterXXX() {Update,Add,Remove,Lookup}
>
>On this methods I can implement particular business logic
>(saving/removing files, adding/removing object from lists, etc).
>
>PROBLEM :
>
>If I want to change a collection that OJB is using on 
>
>deleteReferences()
>storeReferences()
>deleteCollections()
>storeCollections()
>
>I get a java.util.ConcurrentModificationException
>because OJB is using a Iterator on the same collection I'm trying to
>modify ! To SOLVE this problem I have to make OJB use defensive copies
>of collections before iterating through them !
>
>I can't think of any problem that this change should rise besides
>performance ones.
>
>I made a simple modification on deleteCollections and all tests (the
>ones that were passing) still pass !
>
>If there are no objections I'll implement this !
>
>Maybe a flag on reference/collection descriptors to indicate that a
>defensive copy should be used is fine !
>
>Any comments ??
>
>
>
>  
>


Mime
View raw message