Re: FW: [OJB-developers] recursive dependency with ODMG
Brought to you by:
thma
|
From: Thomas M. <tho...@ho...> - 2002-05-19 13:38:34
|
Hi Matthew,
Oops, I see...
This really should solve this issue.
I think there are some other places where we'll need additional handling
to avoid non-terminating recursions and other recursion related problems
with circular object-nets.
(e.g. in PB.store(obj) or in PB.delete(obj))
cheers,
Thomas
Matthew Baird wrote:
> Hi Thomas,
>
> I solved this problem by doing this:
>
> private void lockReferences(ClassDescriptor cld, Object newTxObject, int
> lockMode)
> throws IllegalAccessException, PersistenceBrokerException
> {
> registeredForLock.put(newTxObject, newTxObject);
> Iterator i = cld.getObjectReferenceDescriptors().iterator();
> while (i.hasNext())
> {
> ObjectReferenceDescriptor rds =
> (ObjectReferenceDescriptor) i.next();
> Object refObj =
> rds.getPersistentField().get(newTxObject);
> if (refObj != null)
> {
> if (registeredForLock.containsKey(refObj))
> {
> ; //nuttin
> }
> else
> {
> lock(refObj, lockMode);
> }
> }
> }
> }
>
> basically, I maintain another map of objects that are currently being locked
> (different than the registration). Then I register the newTxObject in the
> map at the beginning, and as I iterate through the reference descriptors, if
> I hit one that is already in play for locking, I just ignore it. It works
> for my test cases, but I wanted to make sure you didn't think this was a bad
> solution.
>
> Overall, I don't think there are a lot of people using the ODMG interfaces.
>
>
>
> -----Original Message-----
> From: Thomas Mahler [mailto:tho...@ho...]
> Sent: Monday, May 13, 2002 1:08 AM
> To: Matthew Baird
> Subject: Re: FW: [OJB-developers] recursive dependency with ODMG
>
> I'll have a look at it !
>
> cu,
>
> Thomas
>
> Matthew Baird wrote:
>
>
>> <<OneToOneTest.zip>>
>>could you take a look at this problem?
>>
>>both joachim and i are having trouble because of it :(
>>
>>-----Original Message-----
>>From: Joa...@tp...
>>To: Matthew Baird
>>Sent: 5/8/02 1:35 AM
>>Subject: RE: [OJB-developers] recursive dependency with ODMG
>>
>>Hy,
>>
>>Here's the test-case.
>>
>>
>>
>>regards
>>Joachim Sauer
>> <<OneToOneTest.zip>>
>>
>>
>
>
>
>
|