Using EntryProcessor arguments recommendations

classic Classic list List threaded Threaded
2 messages Options
Григорий Доможиров Григорий Доможиров
Reply | Threaded
Open this post in threaded view
|

Using EntryProcessor arguments recommendations

I see two options of using EntryProcessor:
1. Pass arguments like this:
cache.invoke(key, new CustomProcessor(), someValue)
2. Pass stateful  EntryProcessor like this:
  cache.invoke(key, new CustomProcessor(someValue))

Is there any recommendations?
aealexsandrov aealexsandrov
Reply | Threaded
Open this post in threaded view
|

Re: Using EntryProcessor arguments recommendations

Hi,

I suggest to read the documentation:

EntryProcessor:

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/CacheEntry.html
Invoke java doc:

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/IgniteCache.html#invoke-K-org.apache.ignite.cache.CacheEntryProcessor-java.lang.Object...-

CacheAtomicityMode specific:

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/CacheAtomicityMode.html

Note, that using invoke and invokeAll you will block the keys. It means
that deadlock is possible in the following cases:

1)You use external keys inside EntryProcessor
2)Use unordered maps for invokeAll. TreeMap is suggested.

BR,
Andrei

2/12/2020 12:18 AM, Григорий Доможиров пишет:
> I see two options of using EntryProcessor:
> 1. Pass arguments like this:
> cache.invoke(key, new CustomProcessor(), someValue)
> 2. Pass stateful EntryProcessor like this:
>   cache.invoke(key, new CustomProcessor(someValue))
>
> Is there any recommendations?