GemFire provides a default implementation for ResultCollector. Applications can choose to implement their own custom ResultCollector. A custom ResultCollector facilitates result sorting or aggregation. Aggregation functions like sum, minimum, maximum and average can also be applied to the result using a custom ResultCollector. Example:
ResultCollectorPtr rc = FunctionService::onRegion(region)
->withArgs(args)
->withFilter(keySet)
->withCollector(new MyCustomResultCollector())
.execute(Function);
//Application can do something else here before retrieving the result
CacheableVectorPtr functionResult = rc.getResult();
Public Member Functions | |
| virtual void | addResult (CacheablePtr &resultOfSingleExecution) |
| Adds a single function execution result to the ResultCollector. | |
| virtual void | clearResults () |
| GemFire will invoke this method before re-executing function (in case of Function Execution HA) This is to clear the previous execution results from the result collector. | |
| virtual void | endResults () |
| GemFire will invoke this method when function execution has completed and all results for the execution have been obtained and added to the ResultCollector}. | |
| virtual CacheableVectorPtr | getResult (uint32_t timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT) |
| Returns the result of function execution, potentially blocking until all the results are available. | |
| void | preserveSB () const |
| Atomically increment reference count. | |
| int32_t | refCount () |
| |
| void | releaseSB () const |
| Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. | |
| ResultCollector () | |
| gemfire::ResultCollector::ResultCollector | ( | ) |
public methods
| virtual void gemfire::ResultCollector::addResult | ( | CacheablePtr & | resultOfSingleExecution | ) | [virtual] |
Adds a single function execution result to the ResultCollector.
| resultOfSingleExecution |
| virtual void gemfire::ResultCollector::clearResults | ( | ) | [virtual] |
GemFire will invoke this method before re-executing function (in case of Function Execution HA) This is to clear the previous execution results from the result collector.
| virtual void gemfire::ResultCollector::endResults | ( | ) | [virtual] |
GemFire will invoke this method when function execution has completed and all results for the execution have been obtained and added to the ResultCollector}.
| virtual CacheableVectorPtr gemfire::ResultCollector::getResult | ( | uint32_t | timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT |
) | [virtual] |
Returns the result of function execution, potentially blocking until all the results are available.
| timeout | in seconds, if result is not ready within this time, exception will be thrown |
| FunctionException | if result retrieval fails |
| void gemfire::SharedBase::preserveSB | ( | ) | const [inherited] |
Atomically increment reference count.
| int32_t gemfire::SharedBase::refCount | ( | ) | [inline, inherited] |
| void gemfire::SharedBase::releaseSB | ( | ) | const [inherited] |
Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.