icegem-core/src/main/java/com/googlecode/icegem/query/pagination/PaginatedQuery.java
public List<V> page(int pageNumber) throws QueryException {
		List<Object> pageKeys = null;
		boolean firstTry = true;

		while (pageKeys == null) {
			prepareResultData(!firstTry);

			if (!pageExists(pageNumber)) {
				throw new IndexOutOfBoundsException("The page " + pageNumber
						+ "does not exists. " + +getTotalNumberOfPages()
						+ " pages available.");

			}

			PageKey pageKey = newKey(pageNumber);
			pageKeys = paginatedQueryInfoRegion.get(pageKey);

			if (pageKeys == null && firstTry) {
				firstTry = false;
			} else {
				break;
			}
		}

		if (pageKeys != null) {
			return getValues(pageKeys);
		} else {
			throw new RuntimeException(
					"Unable to load keys from cache. Too aggressive expiration policy?");
		}
	}
public List<V> page(int pageNumber) throws QueryException {
		List<Object> pageKeys = null;
		boolean firstTry = true;

		while (pageKeys == null) {
			prepareResultData(!firstTry);

			if (!pageExists(pageNumber)) {
				throw new IndexOutOfBoundsException("The page " + pageNumber
						+ "does not exists. " + +getTotalNumberOfPages()
						+ " pages available.");

			}

			PageKey pageKey = newKey(pageNumber);
			pageKeys = paginatedQueryInfoRegion.get(pageKey);

			if (pageKeys == null && firstTry) {
				firstTry = false;
			} else {
				break;
			}
		}

		if (pageKeys != null) {
			return getValues(pageKeys);
		} else {
			throw new RuntimeException(
					"Unable to load keys from cache. Too aggressive expiration policy?");
		}
	}
Returns entries for a specified page number. Use getTotalNumberOfPages()
method to know how many pages this query has.

@param pageNumber
number of page to return
@throws com.gemstone.gemfire.cache.query.QueryException
during query execution

@return List<V> list of entries