You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by Dan Smith <ds...@pivotal.io> on 2020/03/02 22:26:25 UTC

Re: Function execute method thread safety

I think what the javadocs are getting at is that the same function object
may have the execute method invoked concurrently by many threads.

The best way to make the function thread safe is to make it stateless or
immutable, so that it doesn't matter how many threads are accessing the
function. If the function needs to compute some state and store it -
consider storing that state in a geode region. That way you get high
availability of the state as well.

-Dan

On Thu, Feb 27, 2020 at 3:26 AM aashish choudhary <
aashish.choudhary1@gmail.com> wrote:

> No-one?
> We ended up synchronising execute method call. Is this a good approach
> tonthis solution?
>
>
> With best regards,
> Ashish
>
> On Tue, Feb 25, 2020, 11:42 PM aashish choudhary <
> aashish.choudhary1@gmail.com> wrote:
>
>> We are suspecting that during call to execute method when we get
>> arguments that time shared state of request object is running into
>> threading issue. Is that one of the possibility?
>>
>> With best regards,
>> Ashish
>>
>> On Tue, Feb 25, 2020, 4:32 PM aashish choudhary <
>> aashish.choudhary1@gmail.com> wrote:
>>
>>> We are experiencing some threading issue while executing function with
>>> multiple threads. Although documents says that execute method needs to be
>>> thread safe.
>>> https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/execute/Function.html
>>>
>>> Will it not make the calls sequential and slow things down.?
>>>
>>> Thoughts?
>>>
>>> With best regards,
>>> Ashish
>>>
>>