Jens Deppe created GEODE-1320:
---------------------------------
Summary: 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
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
(v6.3.4#6332)