@Override public String toString() { return MoreObjects.toStringHelper(getClass()) .add("host", this.host) .add("keyspace", config.getKeyspaceOrThrow()) .add("usingSsl", config.usingSsl()) .add("sslConfiguration", config.sslConfiguration().isPresent() ? config.sslConfiguration().get() : "unspecified") .add("socketTimeoutMillis", config.socketTimeoutMillis()) .add("socketQueryTimeoutMillis", config.socketQueryTimeoutMillis()) .toString(); }
@Override public CassandraClient create() throws Exception { try { return instrumentClient(getRawClientWithKeyspace(addr, config)); } catch (Exception e) { String message = String.format("Failed to construct client for %s/%s", addr, config.getKeyspaceOrThrow()); if (config.usingSsl()) { message += " over SSL"; } throw new ClientCreationFailedException(message, e); } }
if (config.usingSsl()) { boolean success = false; try {
private static Cassandra.Client getRawClientWithKeyspace(InetSocketAddress addr, CassandraKeyValueServiceConfig config) throws Exception { Client ret = getRawClient(addr, config); try { ret.set_keyspace(config.getKeyspaceOrThrow()); log.debug("Created new client for {}/{}{}{}", SafeArg.of("address", CassandraLogHelper.host(addr)), UnsafeArg.of("keyspace", config.getKeyspaceOrThrow()), SafeArg.of("usingSsl", config.usingSsl() ? " over SSL" : ""), UnsafeArg.of("usernameConfig", config.credentials().isPresent() ? " as user " + config.credentials().get().username() : "")); return ret; } catch (Exception e) { ret.getOutputProtocol().getTransport().close(); throw e; } }
@Override public String toString() { return MoreObjects.toStringHelper(getClass()) .add("host", this.host) .add("keyspace", config.getKeyspaceOrThrow()) .add("usingSsl", config.usingSsl()) .add("sslConfiguration", config.sslConfiguration().isPresent() ? config.sslConfiguration().get() : "unspecified") .add("socketTimeoutMillis", config.socketTimeoutMillis()) .add("socketQueryTimeoutMillis", config.socketQueryTimeoutMillis()) .toString(); }
@Override public CassandraClient create() throws Exception { try { return instrumentClient(getRawClientWithKeyspace(addr, config)); } catch (Exception e) { String message = String.format("Failed to construct client for %s/%s", addr, config.getKeyspaceOrThrow()); if (config.usingSsl()) { message += " over SSL"; } throw new ClientCreationFailedException(message, e); } }
if (config.usingSsl()) { boolean success = false; try {
private static Cassandra.Client getRawClientWithKeyspace(InetSocketAddress addr, CassandraKeyValueServiceConfig config) throws Exception { Client ret = getRawClient(addr, config); try { ret.set_keyspace(config.getKeyspaceOrThrow()); log.debug("Created new client for {}/{}{}{}", SafeArg.of("address", CassandraLogHelper.host(addr)), UnsafeArg.of("keyspace", config.getKeyspaceOrThrow()), SafeArg.of("usingSsl", config.usingSsl() ? " over SSL" : ""), UnsafeArg.of("usernameConfig", config.credentials().isPresent() ? " as user " + config.credentials().get().username() : "")); return ret; } catch (Exception e) { ret.getOutputProtocol().getTransport().close(); throw e; } }