private void ping() { try { stats.recordStart(); httpClient.executeAsync(prepareHead().setUri(uri).build(), new ResponseHandler<Object, Exception>() { @Override public Exception handleException(Request request, Exception exception) { // ignore error stats.recordFailure(exception); // TODO: this will technically cause an NPE in httpClient, but it's not triggered because // we never call get() on the response future. This behavior needs to be fixed in airlift return null; } @Override public Object handle(Request request, Response response) { stats.recordSuccess(); return null; } }); } catch (RuntimeException e) { log.warn(e, "Error scheduling request for %s", uri); } }
private void ping() { try { stats.recordStart(); httpClient.executeAsync(prepareHead().setUri(uri).build(), new ResponseHandler<Object, Exception>() { @Override public Exception handleException(Request request, Exception exception) { // ignore error stats.recordFailure(exception); // TODO: this will technically cause an NPE in httpClient, but it's not triggered because // we never call get() on the response future. This behavior needs to be fixed in airlift return null; } @Override public Object handle(Request request, Response response) throws Exception { stats.recordSuccess(); return null; } }); } catch (RuntimeException e) { log.warn(e, "Error scheduling request for %s", uri); } }
private void ping() { try { stats.recordStart(); httpClient.executeAsync(prepareHead().setUri(uri).build(), new ResponseHandler<Object, Exception>() { @Override public Exception handleException(Request request, Exception exception) { // ignore error stats.recordFailure(exception); // TODO: this will technically cause an NPE in httpClient, but it's not triggered because // we never call get() on the response future. This behavior needs to be fixed in airlift return null; } @Override public Object handle(Request request, Response response) { stats.recordSuccess(); return null; } }); } catch (RuntimeException e) { log.warn(e, "Error scheduling request for %s", uri); } }
@Override public boolean shardExists(UUID uuid) { Request request = prepareHead() .addHeader(PRESTO_ENVIRONMENT, environment) .setUri(shardUri(uuid)) .build(); try { StatusResponse status = httpClient.execute(request, createStatusResponseHandler()); if (isOk(status)) { return true; } if (isNotFound(status) || isGone(status)) { return false; } throw badResponse(status); } catch (RuntimeException e) { throw new PrestoException(RAPTOR_BACKUP_ERROR, "Failed to check if shard exists: " + uuid, e); } }
@Override public boolean shardExists(UUID uuid) { Request request = prepareHead() .addHeader(PRESTO_ENVIRONMENT, environment) .setUri(shardUri(uuid)) .build(); try { StatusResponse status = httpClient.execute(request, createStatusResponseHandler()); if (isOk(status)) { return true; } if (isNotFound(status) || isGone(status)) { return false; } throw badResponse(status); } catch (RuntimeException e) { throw new PrestoException(RAPTOR_BACKUP_ERROR, "Failed to check if shard exists: " + uuid, e); } }
private void ping() { try { stats.recordStart(); httpClient.executeAsync(prepareHead().setUri(uri).build(), new ResponseHandler<Object, Exception>() { @Override public Exception handleException(Request request, Exception exception) { // ignore error stats.recordFailure(exception); // TODO: this will technically cause an NPE in httpClient, but it's not triggered because // we never call get() on the response future. This behavior needs to be fixed in airlift return null; } @Override public Object handle(Request request, Response response) { stats.recordSuccess(); return null; } }); } catch (RuntimeException e) { log.warn(e, "Error scheduling request for %s", uri); } }