@NotThreadSafe public class DefaultContinuousAsyncResultSet extends Object implements ContinuousAsyncResultSet
Constructor and Description |
---|
DefaultContinuousAsyncResultSet(com.datastax.oss.driver.internal.core.util.CountingIterator<com.datastax.oss.driver.api.core.cql.Row> iterator,
com.datastax.oss.driver.api.core.cql.ColumnDefinitions columnDefinitions,
int pageNumber,
boolean hasMorePages,
com.datastax.oss.driver.api.core.cql.ExecutionInfo executionInfo,
ContinuousCqlRequestHandler handler) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the continuous query.
|
Iterable<com.datastax.oss.driver.api.core.cql.Row> |
currentPage() |
CompletionStage<? extends ContinuousAsyncResultSet> |
fetchNextPage() |
com.datastax.oss.driver.api.core.cql.ColumnDefinitions |
getColumnDefinitions() |
com.datastax.oss.driver.api.core.cql.ExecutionInfo |
getExecutionInfo() |
boolean |
hasMorePages() |
int |
pageNumber()
Returns the current page's number.
|
int |
remaining() |
boolean |
wasApplied() |
public DefaultContinuousAsyncResultSet(com.datastax.oss.driver.internal.core.util.CountingIterator<com.datastax.oss.driver.api.core.cql.Row> iterator, com.datastax.oss.driver.api.core.cql.ColumnDefinitions columnDefinitions, int pageNumber, boolean hasMorePages, com.datastax.oss.driver.api.core.cql.ExecutionInfo executionInfo, ContinuousCqlRequestHandler handler)
@NonNull public com.datastax.oss.driver.api.core.cql.ColumnDefinitions getColumnDefinitions()
getColumnDefinitions
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
public boolean wasApplied()
wasApplied
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
wasApplied
in interface com.datastax.oss.driver.api.core.cql.AsyncResultSet
@NonNull public com.datastax.oss.driver.api.core.cql.ExecutionInfo getExecutionInfo()
ContinuousAsyncResultSet
Note: because the driver does not support query traces for continuous queries, ExecutionInfo.getTracingId()
will always be null
.
getExecutionInfo
in interface ContinuousAsyncResultSet
getExecutionInfo
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
public int pageNumber()
ContinuousAsyncResultSet
pageNumber
in interface ContinuousAsyncResultSet
public boolean hasMorePages()
hasMorePages
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
@NonNull public Iterable<com.datastax.oss.driver.api.core.cql.Row> currentPage()
currentPage
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
public int remaining()
remaining
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
@NonNull public CompletionStage<? extends ContinuousAsyncResultSet> fetchNextPage() throws IllegalStateException
fetchNextPage
in interface ContinuousAsyncResultSet
fetchNextPage
in interface com.datastax.oss.driver.api.core.AsyncPagingIterable<com.datastax.oss.driver.api.core.cql.Row>
fetchNextPage
in interface com.datastax.oss.driver.api.core.cql.AsyncResultSet
IllegalStateException
public void cancel()
ContinuousAsyncResultSet
There might still be rows available in the current page after the cancellation; these rows can be retrieved normally.
Also, there might be more pages available in the driver's local page cache after the cancellation; these extra pages will be discarded.
Therefore, if you plan to resume the iteration later, the correct procedure is as follows:
getExecutionInfo().getPagingState()
;
executeContinuouslyAsync
again.
ContinuousAsyncResultSet.fetchNextPage()
that are not yet complete
will always complete exceptionally by throwing a CancellationException
, even if
they were obtained before the cancellation.cancel
in interface ContinuousAsyncResultSet
Copyright © 2017–2019. All rights reserved.