public CassandraClient Create(CassandraEndpoint endpoint) { TSocket socket = null; TTransport transport = null; if (endpoint.Timeout == 0) { socket = new TSocket(endpoint.Address, endpoint.Port); } else { socket = new TSocket(endpoint.Address, endpoint.Port, endpoint.Timeout); } if (this.isBufferSizeSet) { transport = new TBufferedTransport(socket, this.bufferSize); } else { transport = new TBufferedTransport(socket); } TProtocol protocol = new TBinaryProtocol(transport); Cassandra.Client cassandraClient = new Cassandra.Client(protocol); CassandraClient client = new CassandraClient(cassandraClient, endpoint); this.logger.Debug(logger.StringFormatInvariantCulture("Created a new connection using: '{0}'", endpoint.ToString())); return client; }
public void Ban(CassandraEndpoint endpoint) { lock (this.blackListedEndpoints) { if (!this.blackListedEndpoints.Contains(endpoint)) { this.blackListedEndpoints.Add(endpoint); } } logger.Warn(logger.StringFormatInvariantCulture("Endpoint '{0}' was banned.", endpoint.ToString())); }