@ThreadSafe public class ContinuousCqlRequestHandler extends Object implements com.datastax.oss.driver.internal.core.channel.ResponseCallback, io.netty.util.concurrent.GenericFutureListener<io.netty.util.concurrent.Future<Void>>, com.datastax.oss.driver.api.core.session.throttling.Throttled
Constructor and Description |
---|
ContinuousCqlRequestHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement,
com.datastax.oss.driver.internal.core.session.DefaultSession session,
com.datastax.oss.driver.internal.core.context.InternalDriverContext context,
String sessionLogPrefix) |
Modifier and Type | Method and Description |
---|---|
protected CompletableFuture<ContinuousAsyncResultSet> |
dequeueOrCreatePending()
Dequeue a response or, if the queue is empty, create the future that will get notified of the
next response, when it arrives.
|
CompletionStage<? extends ContinuousAsyncResultSet> |
handle() |
boolean |
isLastResponse(com.datastax.oss.protocol.internal.Frame responseFrame) |
void |
onFailure(Throwable error)
Invoked when a continuous paging request hits an unexpected error.
|
void |
onResponse(com.datastax.oss.protocol.internal.Frame response)
Invoked when a continuous paging response is received, either a successful or failed one.
|
void |
onStreamIdAssigned(int streamId) |
void |
onThrottleFailure(com.datastax.oss.driver.api.core.RequestThrottlingException error) |
void |
onThrottleReady(boolean wasDelayed) |
void |
operationComplete(io.netty.util.concurrent.Future<Void> future)
Invoked when the write from
sendRequest(Node) completes. |
public ContinuousCqlRequestHandler(@NonNull com.datastax.oss.driver.api.core.cql.Statement<?> statement, @NonNull com.datastax.oss.driver.internal.core.session.DefaultSession session, @NonNull com.datastax.oss.driver.internal.core.context.InternalDriverContext context, @NonNull String sessionLogPrefix)
public void onStreamIdAssigned(int streamId)
onStreamIdAssigned
in interface com.datastax.oss.driver.internal.core.channel.ResponseCallback
public boolean isLastResponse(@NonNull com.datastax.oss.protocol.internal.Frame responseFrame)
isLastResponse
in interface com.datastax.oss.driver.internal.core.channel.ResponseCallback
public void onThrottleReady(boolean wasDelayed)
onThrottleReady
in interface com.datastax.oss.driver.api.core.session.throttling.Throttled
public CompletionStage<? extends ContinuousAsyncResultSet> handle()
public void operationComplete(@NonNull io.netty.util.concurrent.Future<Void> future)
sendRequest(Node)
completes.operationComplete
in interface io.netty.util.concurrent.GenericFutureListener<io.netty.util.concurrent.Future<Void>>
future
- The future representing the outcome of the write operation.public void onResponse(@NonNull com.datastax.oss.protocol.internal.Frame response)
Delegates further processing to appropriate methods: processResultResponse(Result,
Frame)
if the response was successful, or processErrorResponse(Error)
if it wasn't.
onResponse
in interface com.datastax.oss.driver.internal.core.channel.ResponseCallback
response
- the received Frame
.public void onFailure(@NonNull Throwable error)
Delegates further processing to to the retry policy (processRetryDecision(RetryDecision, Throwable)
.
onFailure
in interface com.datastax.oss.driver.internal.core.channel.ResponseCallback
error
- the error encountered, usually a network problem.public void onThrottleFailure(@NonNull com.datastax.oss.driver.api.core.RequestThrottlingException error)
onThrottleFailure
in interface com.datastax.oss.driver.api.core.session.throttling.Throttled
@NonNull protected CompletableFuture<ContinuousAsyncResultSet> dequeueOrCreatePending()
Called from user code, see DefaultContinuousAsyncResultSet.fetchNextPage()
.
Copyright © 2017–2019. All rights reserved.