> I looked at the javadocs on Function#execute(FunctionContext) and did not see any mention of when the ResultSender obtained from FunctionContext can be used.
Sounds like we need to update the javadocs. I just tested this. If you don't call lastResult before your function exits, you get an exception saying "The function [...] did not send a last result" I do think the ResultSender is threadsafe so you should be able to send results from multiple threads. -Dan On Mon, Jan 23, 2017 at 12:06 PM, Swapnil Bawaskar <[email protected]> wrote: > Yes, you should be able to call resultSender.sendResult() from all threads > since the implementation is thread safe. When all threads are done, call > resultSender.lastResult() > > On Mon, Jan 23, 2017 at 10:32 AM, Amit Pandey <[email protected]> > wrote: > >> Ohh ..Is that true, means I can keep sending it till I use lastResult? >> >> >> On Mon, Jan 23, 2017 at 11:26 PM, Darrel Schneider <[email protected] >> > wrote: >> >>> I thought the contract with ResultSender was that you could keep sending >>> results back on it until you call "lastResult." When the Function >>> "execute(FunctionContext)" method completes are the things obtained from >>> the FunctionContext no longer valid? If they are still valid then why does >>> it matter if the Function "execute(FunctionContext)" method completed? >>> I looked at the javadocs on Function#execute(FunctionContext) and did >>> not see any mention of when the ResultSender obtained from FunctionContext >>> can be used. >>> >>> >>> On Sun, Jan 22, 2017 at 12:39 AM, Amit Pandey <[email protected] >>> > wrote: >>> >>>> Okay got it ...We just need to wait for all threads to complete and >>>> then step out of the function...Thats okay for my usecase...Thanks for the >>>> help >>>> >>>> On Sun, Jan 22, 2017 at 6:18 AM, Dan Smith <[email protected]> wrote: >>>> >>>>> Yeah, that's totally fine. The one thing you I think you probably >>>>> shouldn't do is send results with the ResultSender after your function >>>>> ends. So if you are launching threads that send results your function >>>>> should wait for those threads to finish. >>>>> >>>>> Dan >>>>> >>>>> >>>>> -------- Original message -------- >>>>> From: Lyndon Adams <[email protected]> >>>>> Date: 1/21/17 12:30 PM (GMT-08:00) >>>>> To: [email protected] >>>>> Subject: Re: Using threads inside Geode Functions >>>>> >>>>> Yes >>>>> >>>>> Lyndon Adams >>>>> London, SW11 >>>>> >>>>> > On 21 Jan 2017, at 20:06, Amit Pandey <[email protected]> >>>>> wrote: >>>>> > >>>>> > Hi Guys, >>>>> > >>>>> > It it okay if I create user created threads inside the geode >>>>> functions? >>>>> > >>>>> > I have heavy processing which I want to do inside functions for the >>>>> local data there, so is it okay if use some threads inside the functions? >>>>> > >>>>> > Regards >>>>> > AMit >>>>> >>>> >>>> >>> >> >
