Dear igniters,
I would like to elicit your expert
advice in regards to how ignite differentiates
on the use of a call to: 1)IgniteCompute.affinityRun(...)
and
2)IgniteCache.invoke(...)
as far as dead locks are concerned. According to the documentation the main
difference is that method 2 above, operates within a lock. Specifically the doc
quotes:
“EntryProcessors are executed atomically within a lock on the given cache key.”
Now it even comes with a warning that is meant to show how it is supposed to be
used (or conversely NOT to be used):
“You should not access other keys from within the EntryProcessor logic as it
may cause a deadlock.”
But this phrase “other keys” to what kind of keys does it refer to? The
remaining keys of the passed in cache? For e.g. :
Assume a persons cache...
Cache Person<String,Person> personsCache=...
personsCache.invoke("personKey", new EntryProcessor<String, Person, Void>() {
@Override public Object process(MutableEntry<String, Person> entry, Object...
args) {
Person person= entry.getValue(); entry.setValue(person.setOccupation(“foo”));
return null;
}
});
In other words can someone provide an example based on the above dummy code
that would make invoke deadlock so that I could get an understanding of what
the documentation refers to?
Thanks
Evangelos Morakis