Hello,
When you use the entry processor then you lock only provided key. So
when you tries to work with *other keys* (different from provided one)
that are being processed somewhere in other threads then deadlock is
possible because other thread can take lock on these *other keys* and
wait for provided one. Otherwise, entry processor will wait for these
*other keys*. It's typical deadlock.
Sorry, I will not provide the example but hopes that my explanation is
clear.
BR,
Andrei
9/7/2019 6:31 PM, Evangelos Morakis пишет:
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