use of org.apache.geode.internal.cache.execute.InternalResultSender in project geode by apache.
the class RetrieveRegionFunction method retrieveFullRegion.
/** ------------------------------------------ */
/** Retrieve full region data */
/** ------------------------------------------ */
private void retrieveFullRegion(InternalRegionFunctionContext context, boolean partitioned, String desc) {
Iterator<Object[]> entries;
if (partitioned) {
PREntriesIterator<Region.Entry> iter = (PREntriesIterator<Region.Entry>) ((LocalDataSet) PartitionRegionHelper.getLocalDataForContext(context)).entrySet().iterator();
// entries = getPREntryIterator(iter);
entries = getSimpleEntryIterator(iter);
} else {
LocalRegion owner = (LocalRegion) context.getDataSet();
Iterator<Region.Entry> iter = (Iterator<Region.Entry>) owner.entrySet().iterator();
// entries = getRREntryIterator(iter, owner);
entries = getSimpleEntryIterator(iter);
}
InternalResultSender irs = (InternalResultSender) context.getResultSender();
StructStreamingResultSender sender = new StructStreamingResultSender(irs, null, entries, desc);
sender.send();
}
use of org.apache.geode.internal.cache.execute.InternalResultSender in project geode by apache.
the class RetrieveRegionFunction method retrieveRegionWithWhereClause.
/** ------------------------------------------ */
/** Retrieve region data with where clause */
/** ------------------------------------------ */
private void retrieveRegionWithWhereClause(InternalRegionFunctionContext context, LocalRegion localRegion, boolean partitioned, String where, String desc) {
String regionPath = localRegion.getFullPath();
String qstr = "select key, value from " + regionPath + ".entries where " + where;
logger.info(desc + ": " + qstr);
try {
Cache cache = CacheFactory.getAnyInstance();
QueryService queryService = cache.getQueryService();
Query query = queryService.newQuery(qstr);
SelectResults<Struct> results = (SelectResults<Struct>) (partitioned ? query.execute(context) : query.execute());
Iterator<Object[]> entries = getStructIteratorWrapper(results.asList().iterator());
InternalResultSender irs = (InternalResultSender) context.getResultSender();
StructStreamingResultSender sender = new StructStreamingResultSender(irs, null, entries, desc);
sender.send();
} catch (Exception e) {
throw new FunctionException(e);
}
}
Aggregations