thrift-pool-client
thrift-pool-client copied to clipboard
ThriftConnectionPoolProvider.getConnection(ThriftServerInfo thriftServerInfo) should always throw exception
/** {@inheritDoc} */ @Override public TTransport getConnection(ThriftServerInfo thriftServerInfo){ try { return connections.borrowObject(thriftServerInfo); } catch (Exception e) { logger.error("fail to get connection for {}", thriftServerInfo, e); throw new RuntimeException(e); } }
Exception e in catch block is a checked exception and most likely to be TTransportException, we should rethrow it and dealing with it in ThriftClientImpl(remove TServerInfo with connection problem in ThriftConnectionPoolProvider and try to return valid connection from other TServerInfo),i will fork your code and try to fix as i wrote above.
You're right. welcome to pr.