{
final List<Future<QueryResultIterator<Entity>>> futures = new ArrayList<Future<QueryResultIterator<Entity>>>(queries.size());
Transaction txn = datastore.getTransaction();
for (Query query : queries)
{
AsyncPreparedQuery prepared = new AsyncPreparedQuery(query, txn);
Future<QueryResultIterator<Entity>> futureEntities;
FetchOptions fetchOptions = getRootCommand().getFetchOptions();
if (fetchOptions == null)
{
futureEntities = prepared.asFutureQueryResultIterator();
}
else
{
futureEntities = prepared.asFutureQueryResultIterator(fetchOptions);
}
futures.add(futureEntities);
}
return futures;
}