hi martijn,
On 9/14/07, Martijn Hendriks <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> The ItemManager has a small number of synchronized methods such as
> getItem(ItemId id), which is heavily used. I cannot figure out why these
> calls must be synchronized...can somebody give me an idea? Thanks!
the ItemManager maintains a cache of NodeImpl/PropertyImpl instances.
#getItem(itemId) e.g. is synchronized in order to guarantee the cache
integrity. the following code fragment needs to be synchronized, otherwise
cache entries might get accidentally overwritten:
// check cache
ItemImpl item = retrieveItem(id);
if (item == null) {
....
// create instance of item
item = createItemInstance(id);
}
cheers
stefan
>
> Best wishes,
>
> Martijn
>
>
> --
>
> Martijn Hendriks
> <GX> creative online development B.V.
>
> t: 024 - 3888 261
> f: 024 - 3888 621
> e: [EMAIL PROTECTED]
>
> Wijchenseweg 111
> 6538 SW Nijmegen
> http://www.gx.nl/
>