4 Replies Latest reply on Jul 19, 2012 6:44 PM by Carsten Lohmann

    Return value of Cache.remove(key) in transactional context

    Carsten Lohmann Newbie

      Hi,

       

      we have a scenario where multiple threads try to remove the same cache entry via "cache.remove(key)".

       

      I would expext the return value of the first "cache.remove(key)" invocation to be non-null and all the following invocations to return null.

      But even with explicit transactions and locks, there seem to be occasions where more than one thread gets a non-null value as return value.

       

      In order to reproduce the behaviour, the "org.infinispan.tx.DummyTxTest" test class can be used.

      The line

      boolean success = cache.remove("k1", "v1");
      

      should be replaced with

      boolean success = (cache.remove("k1") != null);
      

       

      I assume this is a bug, right?

      Using "cache.remove(key, value)" (as done in the DummyTxTest class) seems to work as expected.

       

      Cheers,

      Carsten