String framed = properties.getProperty(CassandraProperties.FRAMED_TRANSPORT);
boolean isFramed = (framed != null && Boolean.valueOf(framed));
Client client = th.get();
if (client == null) {
TTransport transport = new TSocket(host, port);
((TSocket) transport).setTimeout(10000);
// wrap transport if framed transport is enabled
if (isFramed) {
transport = new TFramedTransport(transport);
}
TProtocol protocol = new TBinaryProtocol(transport);
transport.open();
client = new Client(protocol);
th.set(client);
}
return client;
}