Cassandra.Client client = new Cassandra.Client(protocol); if (config.credentials().isPresent()) { try { login(client, config.credentials().get()); } catch (TException e) { client.getOutputProtocol().getTransport().close();
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; } }
Cassandra.Client client = new Cassandra.Client(protocol); if (config.credentials().isPresent()) { try { login(client, config.credentials().get()); } catch (TException e) { client.getOutputProtocol().getTransport().close();
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; } }