Hi,

I am trying to test the distributed transaction support using following
piece of code. While debugging the code I observed that code executes on
client node first and after doing commit the code executes on a node which
owns that kay.

What I am trying to do is, to collocate the data to avoid the network call
as my data in real use case is going to big. But while debugging the code,
I observed that entry processor first executes on client node, gets all the
data executes the task. and after commit executes the same code on remote
node.

Can someone please explain this behavior? My use case to execute the task
on nodes which owns the data in single transaction.

private static void executeEntryProcessorTransaction(IgniteCache<Long,
Person> cache) {
    Person val=null;
    try (Transaction tx =
Ignition.ignite().transactions().txStart(TransactionConcurrency.OPTIMISTIC,TransactionIsolation.SERIALIZABLE))
{
  long myid =6l;
        CacheEntryProcessor entryProcessor = new MyEntryProcessor();
        cache.invoke(myid, entryProcessor);
        System.out.println("Overwrote old value: " + val);
        val = cache.get(myid);
        System.out.println("Read value: " + val);

        tx.commit();
        System.out.println("Read value after commit: " +   cache.get(myid));
    }
}



Thanks,
Prasad

Reply via email to