VMware GemFire Native C++ Reference  9.1
apache::geode::client::ResultCollector Class Reference

Defines the interface for a container that gathers results from function execution. More...

Inherits apache::geode::client::SharedBase.

Public Member Functions

virtual void addResult (CacheablePtr &resultOfSingleExecution)
 Adds a single function execution result to the ResultCollector. More...
 
virtual void clearResults ()
 Geode 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. More...
 
virtual void endResults ()
 Geode will invoke this method when function execution has completed and all results for the execution have been obtained and added to the ResultCollector}. More...
 
virtual CacheableVectorPtr getResult (uint32_t timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)
 Returns the result of function execution, potentially blocking until all the results are available. More...
 
void preserveSB () const
 Atomically increment reference count. More...
 
int32_t refCount ()
 
void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. More...
 
 ResultCollector ()
 public methods More...
 

Detailed Description

Defines the interface for a container that gathers results from function execution.


Geode 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();
See also
FunctionService

Constructor & Destructor Documentation

apache::geode::client::ResultCollector::ResultCollector ( )

public methods

Member Function Documentation

virtual void apache::geode::client::ResultCollector::addResult ( CacheablePtr resultOfSingleExecution)
virtual

Adds a single function execution result to the ResultCollector.

Parameters
resultOfSingleExecution
Since
5.8LA
virtual void apache::geode::client::ResultCollector::clearResults ( )
virtual

Geode 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.

Since
6.5
virtual void apache::geode::client::ResultCollector::endResults ( )
virtual

Geode 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 apache::geode::client::ResultCollector::getResult ( uint32_t  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT)
virtual

Returns the result of function execution, potentially blocking until all the results are available.

If geode sendException is called then ResultCollector.getResult will not throw exception but will have exception UserFunctionExecutionException as a part of results received.

Parameters
timeoutin seconds, if result is not ready within this time, exception will be thrown
Returns
the result
Exceptions
FunctionExceptionif result retrieval fails
See also
UserFunctionExecutionException
void apache::geode::client::SharedBase::preserveSB ( ) const
inherited

Atomically increment reference count.

int32_t apache::geode::client::SharedBase::refCount ( )
inlineinherited
Returns
the reference count
void apache::geode::client::SharedBase::releaseSB ( ) const
inherited

Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.


Pivotal GemFire C++ Cache API Documentation