[infinispan-dev] Issue with transaction rollback

Faseela K faseela.k at ericsson.com
Sun Nov 10 01:58:09 EST 2013


Hi Sanne,

Thanks for the reply.
Is there any infinispan "get" api, which returns a copy of the actual object, rather than returning the reference?
Because, in my case, I need the value stored in the cache to arrive at the new value.
Just wanted to know if it is possible to solve the issue without cloning the object.

Thanks,
Faseela
 

-----Original Message-----
From: infinispan-dev-bounces at lists.jboss.org [mailto:infinispan-dev-bounces at lists.jboss.org] On Behalf Of Sanne Grinovero
Sent: Sunday, November 10, 2013 2:21 AM
To: infinispan -Dev List
Subject: Re: [infinispan-dev] Issue with transaction rollback

Hi Faseela,
you should not attempt to mutate the value retrieved from the Cache.
I would suggest to only store immutable objects in a Cache; in other words rather than invoking a setter on property Name, replace the entry with a new instance of Rollback which has the new name.

Sanne

On 9 November 2013 19:31, Faseela K <faseela.k at ericsson.com> wrote:
> Hi,
>
>    The issue I mentioned below was not related to nested transactions.
>    I debugged further, and the issue narrowed down to the following:
>
>       EmbeddedCacheManager manager = new 
> DefaultCacheManager("config/infinispan-config.xml");
>       Configuration rc = manager.getCacheConfiguration("transaction");
>       manager.defineConfiguration("test1", rc);
>       ConcurrentMap<String, Rollback> cache1 = manager.getCache("test1");
>       TransactionManager tm =
> manager.getCache("transaction").getAdvancedCache().getTransactionManager();
>       Rollback t1 = new Rollback("k1", "v1");
>       cache1.put("k1", t1);
>       tm.begin();
>       Rollback tmp = cache1.get("k1");
>       tmp.setName("abcd");
>       cache1.replace("k1", tmp);
>       tm.rollback();
>
>       Even after doing the rollback, "k1" still points to name "abcd".
>       Only if I do a cache1.get("k1").clone(), rollback is functioning 
> as expected.
>
> Thanks,
> Faseela
>
>
>
> ________________________________
> From: infinispan-dev-bounces at lists.jboss.org
> [mailto:infinispan-dev-bounces at lists.jboss.org] On Behalf Of Faseela K
> Sent: Friday, November 08, 2013 6:39 PM
> To: infinispan -Dev List
> Subject: [infinispan-dev] Issue with nested transactions
>
> Hi,
>
>   I have two osgi bundles, both having two separate caches.
>   I explicitly started a transaction in Bundle 1.
>   Within the transaction, I am accessing Bundle 2's cache(this is 
> implicit transaction, since autocommit is true), and modifying it.
>   Now, there is some operation on Bundle 1's cache done.
>   After this operation, if I do a roll back,  Only Bundle 1's cache 
> operations are getting rolled back.
>   I am not getting any error, though.
>   Does anyone know why this happens?
>
>   Steps :
>
>     1) Bundle 1 - transaction started
>     2) update bundle 2 cache
>     3) update bundle 1 cache
>     4) Bundle 1 - transaction rollback
>
>     Issue : bundle 2 cache not rolled back!!
>
> Thanks,
> Faseela
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
_______________________________________________
infinispan-dev mailing list
infinispan-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/infinispan-dev



More information about the infinispan-dev mailing list