public class ExecutionInfo extends Object
Constructor and Description |
---|
ExecutionInfo(int speculativeExecutions,
int successfulExecutionIndex,
List<Host> triedHosts,
ConsistencyLevel achievedConsistency,
Map<String,ByteBuffer> customPayload) |
Modifier and Type | Method and Description |
---|---|
ConsistencyLevel |
getAchievedConsistencyLevel()
If the query returned without achieving the requested consistency level
due to the
RetryPolicy , this
return the biggest consistency level that has been actually achieved by
the query. |
Map<String,ByteBuffer> |
getIncomingPayload()
Return the incoming payload, that is, the payload that the server
sent back with its response, if any,
or
null , if the server did not include any custom payload. |
PagingState |
getPagingState()
The paging state of the query.
|
byte[] |
getPagingStateUnsafe()
Returns the "raw" paging state of the query.
|
Host |
getQueriedHost()
Return the Cassandra host that coordinated this query.
|
QueryTrace |
getQueryTrace()
Return the query trace if tracing was enabled on this query.
|
ListenableFuture<QueryTrace> |
getQueryTraceAsync()
Placeholder for async query trace retrieval (not implemented yet).
|
int |
getSpeculativeExecutions()
The number of speculative executions that were started for this query.
|
Statement |
getStatement()
Get the statement that has been executed.
|
int |
getSuccessfulExecutionIndex()
The index of the execution that completed this query.
|
List<Host> |
getTriedHosts()
The list of tried hosts for this query.
|
List<String> |
getWarnings()
Returns the server-side warnings for this query.
|
boolean |
isSchemaInAgreement()
Whether the cluster had reached schema agreement after the execution of this query.
|
public ExecutionInfo(int speculativeExecutions, int successfulExecutionIndex, List<Host> triedHosts, ConsistencyLevel achievedConsistency, Map<String,ByteBuffer> customPayload)
public List<Host> getTriedHosts()
RetryPolicy
may retry the
query on the same host, so the same host might appear twice.speculative executions
are enabled, this will also contain hosts that were tried by other executions (however, note that
this only contains hosts which timed out, or for which a response was received; if an execution is
waiting for a response from a host and another execution completes the request in the meantime, then
the host of the first execution will not be in that list).getQueriedHost()
provides a shortcut to
fetch the last element of the list returned by this method.public Host getQueriedHost()
getTriedHosts().get(getTriedHosts().size() - 1)
.public int getSpeculativeExecutions()
This does not include the initial, normal execution of the query. Therefore, if speculative executions are disabled, this will always be 0. If they are enabled and one speculative execution was triggered in addition to the initial execution, this will be 1, etc.
public int getSuccessfulExecutionIndex()
0 represents the initial, normal execution of the query, 1 represents the first speculative execution, etc.
public ConsistencyLevel getAchievedConsistencyLevel()
RetryPolicy
, this
return the biggest consistency level that has been actually achieved by
the query.
Note that the default RetryPolicy
(DefaultRetryPolicy
)
will never allow a query to be successful without achieving the
initially requested consistency level and hence with that default
policy, this method will always return null
. However, it
might occasionally return a non-null
with say,
DowngradingConsistencyRetryPolicy
.null
if the original consistency level of the query was
achieved, or the consistency level that was ultimately achieved if the
RetryPolicy
triggered a retry at a different consistency level
than the original one.public QueryTrace getQueryTrace()
QueryTrace
object for this query if tracing was
enable for this query, or null
otherwise.public ListenableFuture<QueryTrace> getQueryTraceAsync()
getQueryTrace()
in
an immediate future; it will still trigger a blocking query when the query
trace's fields are accessed.getQueryTrace()
.public PagingState getPagingState()
Statement.setPagingState(PagingState)
public byte[] getPagingStateUnsafe()
getPagingState()
, there will be no validation when
this is later reinjected into a statement.Statement.setPagingStateUnsafe(byte[])
public boolean isSchemaInAgreement()
Cluster.Builder.withMaxSchemaAgreementWaitSeconds(int)
).
If this method returns false
, clients can call Metadata.checkSchemaAgreement()
later to perform the check manually.
Note that the schema agreement check is only performed for schema-altering queries
For other query types, this method will always return true
.true
for a non
schema-altering statement.public List<String> getWarnings()
ProtocolVersion.V4
or above; with lower
versions, the returned list will always be empty.public Map<String,ByteBuffer> getIncomingPayload()
null
, if the server did not include any custom payload.
This method returns a read-only view of the original map, but
its values remain inherently mutable.
Callers should take care not to modify the returned map in any way.
This feature is only available with ProtocolVersion.V4
or above; with lower
versions, this method will always return null
.null
, if the server did not include any custom payload.public Statement getStatement()
Copyright © 2012–2018. All rights reserved.