You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Barbara Pruijn (JIRA)" <ji...@apache.org> on 2018/03/29 17:20:00 UTC
[jira] [Resolved] (GEODE-1320) gfsh function execution does not
report errors correctly
[ https://issues.apache.org/jira/browse/GEODE-1320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Barbara Pruijn resolved GEODE-1320.
-----------------------------------
Resolution: Won't Do
> gfsh function execution does not report errors correctly
> --------------------------------------------------------
>
> Key: GEODE-1320
> URL: https://issues.apache.org/jira/browse/GEODE-1320
> Project: Geode
> Issue Type: Bug
> Components: gfsh
> Reporter: Jens Deppe
> Priority: Major
>
> I have a locator and a server and am trying to execute a simple function using a {{ResultCollector}} as follows:
> {noformat}
> gfsh> execute function --id=basic-function --region=FOO -\
> -result-collector=io.pivotal.gemfire.ToUpperResultCollector
> {noformat}
> The result is simply:
> {noformat}
> io.pivotal.gemfire.ToUpperResultCollector
> {noformat}
> This occurs if my collector class is not on the classpath of the locator. in {{FunctionCommands.executeFunction}} the collector is trying to be instantiated but a {{ClassNotFoundException}} is generated and does not make it back to the client.
> Here is the code for the collector:
> {code:java}
> public class ToUpperResultCollector implements ResultCollector {
> private List<Object> results = new ArrayList<>();
> private CountDownLatch latch = new CountDownLatch(1);
> @Override
> public Object getResult() throws FunctionException {
> try {
> latch.await();
> } catch (InterruptedException e) {
> throw new FunctionException("Interrupted waiting for results", e);
> }
> return results;
> }
> @Override
> public Object getResult(long timeout, TimeUnit unit) throws FunctionException, InterruptedException {
> latch.await(timeout, unit);
> return results;
> }
> @Override
> public void addResult(DistributedMember memberID, Object resultOfSingleExecution) {
> results.add(resultOfSingleExecution.toString().toUpperCase());
> }
> @Override
> public void endResults() {
> latch.countDown();
> }
> @Override
> public void clearResults() {
> results.clear();
> latch = new CountDownLatch(1);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)