You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "kimec.ethome.sk" <ki...@ethome.sk> on 2019/05/23 12:02:03 UTC

How to use transaction.commitAsync()?

Let's assume I need to update an item in a cache and then invoke 
commitAsync(). Is the following a valid code pattern?

Transaction transaction = ignite.transactions().txStart();
cache.putAsync(key, value); // this
cache.put(key, value); // or this
transaction.commitAsync().listen(fut -> /* respond to the caller */);

Thanks!

Kamil

Re: How to use transaction.commitAsync()?

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

Yes, it should be fine.

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/lang/IgniteFuture.html#listen-org.apache.ignite.lang.IgniteInClosure-

BR,
Andrei



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