On 18 mai 2011, at 12:23, Manik Surtani wrote:
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?
IllegalStateException works, I'd say
/**
* Signals that a method has been invoked at an illegal or
* inappropriate time. In other words, the Java environment or
* Java application is not in an appropriate state for the requested
* operation.
*/