ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkulichenko <valentin.kuliche...@gmail.com>
Subject Re: How to perform lazy write to database
Date Mon, 11 Apr 2016 05:16:19 GMT
Ignite instance is thread safe, so you can use the same instance to execute
separate transactions from different Java threads. No need to start a new
node for each transaction. You can do smth like this (pseudocode):

try (Transaction tx = ignite.transactions().startTx()) {
    cache.put(k1, v1);
    cache.put(k2, v2);

    new Thread(new Runnable() {
        try (Transaction tx = ignite.transactions().startTx()) {
            v1 = cache.get(k1);
            v2 = cache.get(k2);
        }
    }).start();

    tx.commit();
}

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-perform-lazy-write-to-database-tp4002p4046.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message