Refactor thrift client factory