Hi Andrei,
>>From your source code, I can see that the QueryCursor was created inside
startContinuousQuery. Then you return it from that method, but don't store
it in any variable:
>>continuousQueryHelper.startContinuousQuery(ignite,qry,testCache,subscribeParameters.callBackList,outputFieldsList);
I dont need to store the cursor that is returned from startContinuousQuery
because the cursor is read within the startContinuousQuery .
Please find the code within startContinuousQuery in ContinuousQueryHelper
class . The cursor is stored in a variable and read through in the loop .
// Create new continuous query.
QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> cur =
cache.query(qry);
LOGGER.info(
"PROJECT LISTENS: >>> Cache continuous query started
successfully. Start Initial Query...{}",
qry.getInitialQuery());
// Iterate through existing data.
// Please note there is a strange behaviour here. The iterator
returns a iterator of Cache.Entry<BinaryObject, BinaryObject>
// However, each of the element of the iterator is actually not
Cache.Entry<BinaryObject, BinaryObject> .
// Each element of the iterator is List of fields in a row. ( i.e.
it matches what is supposed to be returned by
// SQLFieldsQuery.query("query..").getAll();
List addedOrModifiedList = new ArrayList<>();
List removedList = new ArrayList<>();
int count=0;
for (Object e : cur.getAll()) {
BinaryObject
binaryObject=createBinaryObject((List<?>)e,outputFieldsList,ignite,"TEST");
++count;
addedOrModifiedList.add(binaryObject);
LOGGER.debug("PROJECT LISTENS: Initial entry binaryObject : {}
", binaryObject);
}
I am not sure how it can be garbage collected before it is read.
regards,
Veena.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/