You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Andrey Mashenkov <an...@gmail.com> on 2017/03/23 07:10:11 UTC

Re: CacheInterceptor issue

Hi Shawn,

CacheInterceptor should be called once on one node.

On Wed, Mar 22, 2017 at 5:11 AM, shawn.du <sh...@neulion.com.cn> wrote:

> Hi,
>
> If I have multiple-nodes cluster, and I set up a cache interceptor on a
> cache.
> the cache mode is partitioned or duplicated. in partition mode, the cache
> maybe have a backup or not.
> My question is: when a cache entry is removed,  the interceptor will be
> called once on one node or multiple times on multiple node?
>
> Thanks
> Shawn
>
>


-- 
Best regards,
Andrey V. Mashenkov

Re: CacheInterceptor issue

Posted by Andrey Mashenkov <am...@gridgain.com>.
Hi Shawn,

What stream do you mean?
Ignite CacheInterceptorcan be serialized and executed on different node,
possibly you send it with a stream created on client side. If it so, it is
a bad idea.
CacehInterceptor supports resource injecting. See
* org.apache.ignite.resources *package. So, you can make async call of some
code from it, which will do all IO work.

Also it has a note in javadoc:
* Implementations should not execute any complex logic,
* including locking, networking or cache operations,
* as it may lead to deadlock, since this method is called
* from sensitive synchronization blocks.

On Fri, Mar 24, 2017 at 4:16 AM, shawn.du <sh...@neulion.com.cn> wrote:

> Hi Andrey,
>
> Thanks for your reply. one more question:
>
> Does the interceptor need to be thread-safe?  My interceptor throws
> unexpected Io Exceptions like trying to write closed stream.
>
> Thanks
> Shawn
>
> On 03/23/2017 15:18,Andrey Mashenkov<an...@gmail.com>
> <an...@gmail.com> wrote:
>
> Hi Shawn,
>
> CacheInterceptor should be called once on one node.
>
> On Wed, Mar 22, 2017 at 5:11 AM, shawn.du <sh...@neulion.com.cn> wrote:
>
>> Hi,
>>
>> If I have multiple-nodes cluster, and I set up a cache interceptor on a
>> cache.
>> the cache mode is partitioned or duplicated. in partition mode, the
>> cache maybe have a backup or not.
>> My question is: when a cache entry is removed,  the interceptor will be
>> called once on one node or multiple times on multiple node?
>>
>> Thanks
>> Shawn
>>
>>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>
>