For every thrift API call ( using HBase Thrift in Erlang )the API returns a thrift connection:
erlang example:
% creating the initial connection
{ok, TFactory} = thrift_socket_transport:new_transport_factory( "localhost", 9090, []),
{ok, PFactory} = thrift_binary_protocol:new_protocol_factory(TFactory, []),
{ok, Protocol} = PFactory(),
{ok, ThiftConnection1} = thrift_client:new(Protocol, hbase_thrift),
%calling a row mutation
{ThriftConnection2, Result} = thrift_client:call( ThriftConnection1, mutateRow, ["MYTABLE", Row1Id, MutationList1, dict:new()]),
{ThriftConnection3, Result} = thrift_client:call( ThriftConnection2, mutateRow, ["MYTABLE", Row2Id, MutationList2, dict:new()]),
This raises the related inquiries below:
- Should I always use the returned connection or just the first one ?
- Are these connections the same ?
- Will this pass-along-connection approach cause connection leaks ?
- Is there a way to close these connections or they have their own lifecycle for every type of API call that uses them ?
I realized this is not a connection but a thrift-transport reference. I compared them to each other and they are identical. In Erlang, printing their content (serializing) the facts about each of those results indicate they are the same