[infinispan-dev] Questions on AtomicMap and improvement proposals

Manik Surtani manik at jboss.org
Wed May 18 06:23:50 EDT 2011


On 30 Apr 2011, at 20:14, Emmanuel Bernard wrote:

> Another behavior I'm seeing that is surprising me is:
> 
> tx.begin();
> Map<?,?> map = AtomicMapLookup.getAtomicMap(cache, key);
> assert map.size() == 3;
> AtomicMapLookup.removeAtomicMap(cache, key);
> assert map.size() == 0;
> tx.commit();
> 
> I can sort understand in a twisted way that removeAtomicMap clears the underlying map but that's for sure surprising and can lead to weird bugs for ATM users. Is that necessary?

This is weird, from a usage perspective, agreed.

Realistically, any operations that happen on an atomic map handle after the atomic map has been removed should result in an exception.  I can't think of any existing JDK exceptions being valid - perhaps InvalidAtomicMapException?

@Emmanuel, WDYT?

Cheers
Manik

--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org






More information about the infinispan-dev mailing list