return createNewTransport(cacheKey);
}
private TTransport createNewTransport(ThriftTransportKey cacheKey) throws TTransportException {
TTransport transport;
if (cacheKey.getTimeout() == 0) {
transport = AddressUtil.createTSocket(cacheKey.getLocation(), cacheKey.getPort());
} else {
try {
transport = TTimeoutTransport.create(AddressUtil.parseAddress(cacheKey.getLocation(), cacheKey.getPort()), cacheKey.getTimeout());
} catch (IOException ex) {
throw new TTransportException(ex);
}
}
transport = ThriftUtil.transportFactory().getTransport(transport);
transport.open();
if (log.isTraceEnabled())
log.trace("Creating new connection to connection to " + cacheKey.getLocation() + ":" + cacheKey.getPort());
CachedTTransport tsc = new CachedTTransport(transport, cacheKey);