Java源码示例:com.datastax.driver.core.ExecutionInfo
示例1
/**
* Reduces the fetch size and retries the query. Returns true if the query succeeded, false if the root cause
* of the exception does not indicate a frame size issue, if the frame size cannot be adjusted down any further,
* or if the retried query fails for an unrelated reason.
*/
private boolean reduceFetchSize(Throwable reason) {
if (!isAdaptiveException(reason) || --_remainingAdaptations == 0) {
return false;
}
ExecutionInfo executionInfo = _delegate.getExecutionInfo();
Statement statement = executionInfo.getStatement();
PagingState pagingState = executionInfo.getPagingState();
int fetchSize = statement.getFetchSize();
while (fetchSize > MIN_FETCH_SIZE) {
fetchSize = Math.max(fetchSize / 2, MIN_FETCH_SIZE);
_log.debug("Retrying query at next page with fetch size {} due to {}", fetchSize, reason.getMessage());
statement.setFetchSize(fetchSize);
statement.setPagingState(pagingState);
try {
_delegate = _session.execute(statement);
return true;
} catch (Throwable t) {
// Exit the adaptation loop if the exception isn't one where adapting further may help
if (!isAdaptiveException(t) || --_remainingAdaptations == 0) {
return false;
}
}
}
return false;
}
示例2
private ResultSet createPositiveResultSet(String hostName) {
ExecutionInfo executionInfo = mock(ExecutionInfo.class);
Host host = mock(Host.class);
when(host.toString()).thenReturn(hostName);
when(executionInfo.getQueriedHost()).thenReturn(host);
ResultSet resultSet = mock(ResultSet.class);
when(resultSet.getExecutionInfo()).thenReturn(executionInfo);
return resultSet;
}
示例3
private AsyncFuture<QueryTrace> buildTrace(
final Connection c, final QueryTrace.Identifier what, final long elapsed,
List<ExecutionInfo> info
) {
final ImmutableList.Builder<AsyncFuture<QueryTrace>> traces = ImmutableList.builder();
for (final ExecutionInfo i : info) {
com.datastax.driver.core.QueryTrace qt = i.getQueryTrace();
if (qt == null) {
log.warn("Query trace requested, but is not available");
continue;
}
traces.add(getEvents(c, qt.getTraceId()).directTransform(events -> {
final ImmutableList.Builder<QueryTrace> children = ImmutableList.builder();
for (final Event e : events) {
final long eventElapsed =
TimeUnit.NANOSECONDS.convert(e.getSourceElapsed(), TimeUnit.MICROSECONDS);
children.add(QueryTrace.of(QueryTrace.identifier(e.getName()), eventElapsed));
}
final QueryTrace.Identifier segment = QueryTrace.identifier(
i.getQueriedHost().toString() + "[" + qt.getTraceId().toString() + "]");
final long segmentElapsed =
TimeUnit.NANOSECONDS.convert(qt.getDurationMicros(), TimeUnit.MICROSECONDS);
return QueryTrace.of(segment, segmentElapsed, children.build());
}));
}
return async
.collect(traces.build())
.directTransform(t -> QueryTrace.of(what, elapsed, ImmutableList.copyOf(t)));
}
示例4
@Override
public ExecutionInfo getExecutionInfo() {
return _delegate.getExecutionInfo();
}
示例5
@Override
public List<ExecutionInfo> getAllExecutionInfo() {
return _delegate.getAllExecutionInfo();
}
示例6
public ExecutionInfo getExecutionInfo() {
// TODO Auto-generated method stub
return null;
}
示例7
public List<ExecutionInfo> getAllExecutionInfo() {
// TODO Auto-generated method stub
return null;
}
示例8
@Override
public ExecutionInfo getExecutionInfo() {
throw new UnsupportedOperationException();
}
示例9
@Override
public List<ExecutionInfo> getAllExecutionInfo() {
throw new UnsupportedOperationException();
}