Ignite transactions

classic Classic list List threaded Threaded
4 messages Options
ashishb888 ashishb888
Reply | Threaded
Open this post in threaded view
|

Ignite transactions

For below code snippet, if exception occurs do I need to rollback the
transaction? Or closing the transaction takes care of it?

try (Transaction tx = transactions.txStart()) {
    Integer hello = cache.get("Hello");
 
    if (hello == 1)
        cache.put("Hello", 11);
 
    cache.put("World", 22);
 
    tx.commit();
}

BR,
Ashish



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
akorensh akorensh
Reply | Threaded
Open this post in threaded view
|

Re: Ignite transactions

Closing is enough and an explicit rollback is not necessary.





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Mikhail Mikhail
Reply | Threaded
Open this post in threaded view
|

Re: Ignite transactions

In reply to this post by ashishb888
Hi Ashish,

Yes, a transaction will be rolled back if it closed without a successful
commit.

Thanks,
Mike.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ashishb888 ashishb888
Reply | Threaded
Open this post in threaded view
|

Re: Ignite transactions

Thanks guys for response



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/