/** * Used to validate an idle pooled transport is still good for consumption. * @param transport to test * @return if the transport succeeded the validation or not */ private boolean validate(PooledTransport transport) { try { Response response = transport.execute(validationRequest); return response.hasSucceeded(); } catch (IOException ioe) { log.warn("Could not validate pooled connection on lease. Releasing pooled connection and trying again...", ioe); return false; } }
public boolean touch(String index) { if (!indexExists(index)) { Response response = execute(PUT, index, false); if (response.hasFailed()) { String msg = null; // try to parse the answer try { msg = parseContent(response.body(), "error"); } catch (Exception ex) { // can't parse message, move on } if (StringUtils.hasText(msg) && !msg.contains("IndexAlreadyExistsException")) { throw new EsHadoopIllegalStateException(msg); } } return response.hasSucceeded(); } return false; }
/** * Used to validate an idle pooled transport is still good for consumption. * @param transport to test * @return if the transport succeeded the validation or not */ private boolean validate(PooledTransport transport) { try { Response response = transport.execute(validationRequest); return response.hasSucceeded(); } catch (IOException ioe) { log.warn("Could not validate pooled connection on lease. Releasing pooled connection and trying again...", ioe); return false; } }
/** * Used to validate an idle pooled transport is still good for consumption. * @param transport to test * @return if the transport succeeded the validation or not */ private boolean validate(PooledTransport transport) { try { Response response = transport.execute(validationRequest); return response.hasSucceeded(); } catch (IOException ioe) { log.warn("Could not validate pooled connection on lease. Releasing pooled connection and trying again...", ioe); return false; } }
/** * Used to validate an idle pooled transport is still good for consumption. * @param transport to test * @return if the transport succeeded the validation or not */ private boolean validate(PooledTransport transport) { try { Response response = transport.execute(validationRequest); return response.hasSucceeded(); } catch (IOException ioe) { log.warn("Could not validate pooled connection on lease. Releasing pooled connection and trying again...", ioe); return false; } }
public boolean touch(String index) { if (!indexExists(index)) { Response response = execute(PUT, index, false); if (response.hasFailed()) { String msg = null; // try to parse the answer try { msg = parseContent(response.body(), "error"); } catch (Exception ex) { // can't parse message, move on } if (StringUtils.hasText(msg) && !msg.contains("IndexAlreadyExistsException")) { throw new EsHadoopIllegalStateException(msg); } } return response.hasSucceeded(); } return false; }
public boolean touch(String index) { if (!indexExists(index)) { Response response = execute(PUT, index, false); if (response.hasFailed()) { String msg = null; // try to parse the answer try { msg = parseContent(response.body(), "error"); } catch (Exception ex) { // can't parse message, move on } if (StringUtils.hasText(msg) && !msg.contains("IndexAlreadyExistsException")) { throw new EsHadoopIllegalStateException(msg); } } return response.hasSucceeded(); } return false; }
public boolean touch(String indexOrType) { if (!exists(indexOrType)) { Response response = execute(PUT, indexOrType, false); if (response.hasFailed()) { String msg = null; // try to parse the answer try { msg = parseContent(response.body(), "error"); } catch (Exception ex) { // can't parse message, move on } if (StringUtils.hasText(msg) && !msg.contains("IndexAlreadyExistsException")) { throw new EsHadoopIllegalStateException(msg); } } return response.hasSucceeded(); } return false; }
public boolean touch(String index) { if (!indexExists(index)) { Response response = execute(PUT, index, false); if (response.hasFailed()) { String msg = null; // try to parse the answer try { msg = parseContent(response.body(), "error"); } catch (Exception ex) { // can't parse message, move on } if (StringUtils.hasText(msg) && !msg.contains("IndexAlreadyExistsException")) { throw new EsHadoopIllegalStateException(msg); } } return response.hasSucceeded(); } return false; }