public DataStaxClientResponseData(String response, int size, OperationResult<?> result, Object key, Map<?, ?> kv) { super(response, size, (result == null) ? "" : result.getHost().getHostName(), result != null ? result.getLatency(TimeUnit.MILLISECONDS) : 0, key, kv); } }
public AstyanaxResponseData(String response, int size, OperationResult<?> result, Object key, Map<?, ?> kv) { super(response, size, (result == null) ? "" : result.getHost().getHostName(), result != null ? result.getLatency(TimeUnit.MILLISECONDS) : 0, key, kv); } }
public DataStaxClientResponseData(String response, int size, OperationResult<?> result, Object key, Object cn, Object value) { super(response, size, EXECUTED_ON + (result != null ? result.getHost().getHostName() : ""), (result != null ? result .getLatency(TimeUnit.MILLISECONDS) : 0), key, cn, value); }
public AstyanaxResponseData(String response, int size, OperationResult<?> result) { super(response, size, EXECUTED_ON + result != null ? result.getHost().getHostName() : "", result != null ? result.getLatency(TimeUnit.MILLISECONDS) : 0); }
public AstyanaxResponseData(String response, int size, OperationResult<?> result, Object key, Object cn, Object value) { super(response, size, EXECUTED_ON + (result != null ? result.getHost().getHostName() : ""), (result != null ? result.getLatency(TimeUnit.MILLISECONDS) : 0), key, cn, value); }
private Result pingAll() { try { StringBuilder message = new StringBuilder(); OperationResult<CqlStatementResult> astyanaxResult = pingAstyanax(); message.append("Astyanax: ").append(astyanaxResult.getHost()).append(" ") .append(astyanaxResult.getLatency(TimeUnit.MICROSECONDS)).append("us"); if (astyanaxResult.getAttemptsCount() != 1) { message.append(", ").append(astyanaxResult.getAttemptsCount()).append(" attempts"); } Stopwatch cqlTimer = Stopwatch.createStarted(); ResultSet cqlResult = pingCql(); long queryDurationMicros = cqlTimer.elapsed(TimeUnit.MICROSECONDS); Host host = cqlResult.getExecutionInfo().getQueriedHost(); message.append(" | CQL: ").append(host).append(" ").append(queryDurationMicros).append("us"); return Result.healthy(message.toString()); } catch (Throwable t) { return Result.unhealthy(t); } }
private Result pingAll() { try { StringBuilder message = new StringBuilder(); OperationResult<CqlStatementResult> astyanaxResult = pingAstyanax(); message.append("Astyanax: ").append(astyanaxResult.getHost()).append(" ") .append(astyanaxResult.getLatency(TimeUnit.MICROSECONDS)).append("us"); if (astyanaxResult.getAttemptsCount() != 1) { message.append(", ").append(astyanaxResult.getAttemptsCount()).append(" attempts"); } Stopwatch cqlTimer = Stopwatch.createStarted(); ResultSet cqlResult = pingCql(); long queryDurationMicros = cqlTimer.elapsed(TimeUnit.MICROSECONDS); Host host = cqlResult.getExecutionInfo().getQueriedHost(); message.append(" | CQL: ").append(host).append(" ").append(queryDurationMicros).append("us"); return Result.healthy(message.toString()); } catch (Throwable t) { return Result.unhealthy(t); } }
return new OperationResultImpl<SchemaChangeResult>(opResult.getHost(), new SchemaChangeResponseImpl().setSchemaId("no-op"), opResult.getLatency());
return new OperationResultImpl<SchemaChangeResult>(opResult.getHost(), new SchemaChangeResponseImpl().setSchemaId("no-op"), opResult.getLatency());
/** * Read from a {@link CassandraNode} using the Astyanax API. * @throws ConnectionException */ public void readData(String keyspaceName) throws ConnectionException { // Create context AstyanaxContext<Keyspace> context = newAstyanaxContextForKeyspace(keyspaceName); try { Keyspace keyspace = context.getEntity(); // Query data OperationResult<ColumnList<String>> query = keyspace.prepareQuery(sampleColumnFamily) .getKey("one") .execute(); assertEquals(query.getHost().getHostName(), hostname); assertTrue(query.getLatency() > 0L); ColumnList<String> columns = query.getResult(); assertEquals(columns.size(), 2); // Lookup columns in response by name String name = columns.getColumnByName("name").getStringValue(); assertEquals(name, "Alice"); // Iterate through the columns for (Column<String> c : columns) { assertTrue(ImmutableList.of("name", "company").contains(c.getName())); } } finally { context.shutdown(); } }
assertTrue(insert.getLatency() > 0L); } finally { context.shutdown();
OperationResult<R> result = connection.execute(filteredOperation); result.setAttemptsCount(attemptCounter); monitor.incOperationSuccess(getCurrentHost(), result.getLatency()); return result;
OperationResult<R> result = connection.execute(filteredOperation); result.setAttemptsCount(attemptCounter); monitor.incOperationSuccess(getCurrentHost(), result.getLatency()); return result;