[hibernate-dev] Question regarding method ReadWriteEhcacheNaturalIdRegionAccessStrategy#afterInsert

Alex Snaps alex.snaps at gmail.com
Thu Jun 14 16:19:23 EDT 2012


Hey Günther,
I think your patch there makes sense. I will have a closer look though.
Iirc we expect no entry, as the softlock should have been removed, right? I
might be misremembering. I'm not the single author of all this neither. But
I should be able to spend some time on that tomorrow est. currently
wrapping up a release... Sorry for lagging
Alex

On Wednesday, June 13, 2012, Demetz, Guenther wrote:

> Hi Alex,
>
> I have a question in regard to class
> ReadWriteEhcacheNaturalIdRegionAccessStrategy where you are listed as
> co-author.
> Do you maybe know, why inserts do only succeed if there is no existing
> value mapped to the actual key?
>
> Code-snippet of ReadWriteEhcacheNaturalIdRegionAccessStrategy#afterInsert
>
> << if ( item == null ) {
> <<     region.put( key, new Item( value, null, region.nextTimestamp() ) );
>
> Namely I did expect, that in case of item being an "unlocked" Lock, the
> insert should succeed nonetheless.
> Something like following:
>
> >> if ( item == null || item.isWriteable( region.nextTimestamp(), null,
> null ) ) {
> >>    region.put( key, new Item( value, null, region.nextTimestamp() ) );
>
> I ask because after trying to resolve a Todo in StatefulPersistenceContext
> (you find it by searching for "should be using access strategy, not plain
> evict.. "),
> some test in CachedMutableNaturalIdStrictReadWriteTest fails exactly
> because such "re-caching" attempts do not succeed anymore.
>
> best regards
> Guenther Demetz
>
>

-- 
Alex Snaps <alex.snaps at gmail.com>
Senior Software Engineer - Terracotta
http://twitter.com/alexsnaps
http://www.linkedin.com/in/alexsnaps


More information about the hibernate-dev mailing list