Hi Anand,

1. Actually, you should broadcast your logic to all nodes via
Ignite.compute()
Please see the sample below:

        Collection<Integer> res = ignite.compute().broadcast(
            new IgniteCallable<Integer>() {
                /** Auto-inject ignite instance. */
                @IgniteInstanceResource
                private Ignite ignite;

                @Override public Integer call() {
                    IgniteCache<Integer, Integer> cache =
ignite.getOrCreateCache(CACHE_NAME);
                    Iterator<Cache.Entry&lt;Integer, Integer>> iterator =
cache.localEntries().iterator();

                    Integer key;
                    Integer cnt = 0;
                    while (iterator.hasNext()) {
                        key = iterator.next().getKey();

                        Integer res = cache.invoke(key, (entry, args) -> {
                            Integer val = entry.getValue();
                            // do some logic
                            val = val + 1;
                            return val;
                        });
                        cnt++;
                    }
                    return cnt;
                }
            }
        );

        // just ensure that we went through all keys
        int entryCount = 0;
        for (Integer r : res) {
            entryCount += r;
        }

2. And please note that cache.invokeAll() from your code does not store a
new cache entry value back to the Cache. So, you will not see any updates in
the Cache after such invokes.

"val.setAmount(val.getAmt1() + val.getAmt2());"

Thank you,
Alexey





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

Reply via email to