[Opensource] Upgrading from 4.02 to 5.02: DBObject question

Vincent Gogan vincent.gogan at goganinc.com
Thu Jun 19 05:05:32 PDT 2003


Subclassing worked like a charm in the old version and I found it very
useful. I use it in multiple places and would have noticed stale values
quite quickly. I still use it in three or four other classes so I'll have to
figure out how some way to use 'addToCache'. 

In some way I'm surprised that the cache isn't by context/tablename. I
haven't really dealt with multiple contexts yet but what happens if you want
the same DBOBject stored in two different dtabases?

Vincent

-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com] On Behalf Of Michael Rimov
Sent: Wednesday, June 18, 2003 6:44 PM
To: opensource at jcorporate.com
Subject: Re: [Opensource] Upgrading from 4.02 to 5.02: DBObject question


At 02:25 PM 6/18/2003 -0400, you wrote:
>In 4.02, this code worked just fine and the first thread picked up the 
>change. In 5.02, this breaks and the first thread can only acces the 
>old/stale value. One possible
>contributing factor is that thread 1 may be using a derived class:
>
>public class DBExtendedSomeThing extends DBSomeThing {
>         // Just overrides/adds some methods
>}


That is the issue.  Caches are named by DBObject class name.  That's why 
stale values are getting picked up.  To be truthful, I'm not sure why it 
actually worked in the old versions, but I fixed a lot of threading issues 
in the cache, so things may have been working by sheer chance.

The best way that I can see to workaround this issue would be to override 
DBObject.addToCache() for your particular dbobjects to drop the item into a 
specified cache name that both of your objects can find.

HTH!
                                                 -Mike
   


_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/





More information about the Opensource mailing list