[ 
https://issues.apache.org/jira/browse/GEODE-625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15264736#comment-15264736
 ] 

Dan Smith commented on GEODE-625:
---------------------------------

A little be more context on this:

It looks like the current behavior if you call ResultSender.sendResult with an 
exception then the exception is never actually propagated to the user's 
ResultCollector. Instead, it's hidden from the user's ResultCollector but 
thrown from the getResult method of the ResultCollector returned by 
Execution.execute(). That's the same behavior you get if you simply throw an 
exception from the body of the function.

On the other hand, if you call sendException, then the exception *is* passed to 
the addResult method of the users ResultCollector, and does not throw an 
exception.

This seems somewhat backwards. It seems *anything* passed to sendResult and 
lastResult ought to be passed on to the addResult method of the 
ResultCollector. sendException should perhaps trigger the exception behavior we 
are seeing from the default result collector, or be passed to something like an 
addException method on a user's result collector.

Unfortunately, it will be hard to get to the desired behavior in a backwards 
compatible way.  

> A function's ResultCollector throws ClassCastException when 
> ResultSender.sendException is invoked
> -------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-625
>                 URL: https://issues.apache.org/jira/browse/GEODE-625
>             Project: Geode
>          Issue Type: Bug
>          Components: functions
>            Reporter: Ashvin
>            Assignee: Dan Smith
>
> For e.g. If LuceneFunction.execute invokes resultSender.sendException, the 
> following error is generated.
> {code}
> java.lang.ClassCastException: java.lang.IllegalArgumentException cannot be 
> cast to com.gemstone.gemfire.cache.lucene.int
> ernal.distributed.TopEntriesCollector
>       at 
> com.gemstone.gemfire.cache.lucene.internal.distributed.TopEntriesFunctionCollector.addResult(TopEntriesFunctionColle
> ctor.java:1)
>       at 
> com.gemstone.gemfire.internal.cache.execute.LocalResultCollectorImpl.addResult(LocalResultCollectorImpl.java:76)
>       at 
> com.gemstone.gemfire.internal.cache.execute.PartitionedRegionFunctionResultSender.lastResult(PartitionedRegionFuncti
> onResultSender.java:208)
>       at 
> com.gemstone.gemfire.internal.cache.execute.PartitionedRegionFunctionResultSender.lastResult(PartitionedRegionFuncti
> onResultSender.java:166)
>       at 
> com.gemstone.gemfire.internal.cache.execute.PartitionedRegionFunctionResultSender.sendException(PartitionedRegionFun
> ctionResultSender.java:301)
>       at 
> com.gemstone.gemfire.cache.lucene.internal.distributed.LuceneFunction.execute(LuceneFunction.java:52)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to