thrift API 呼び出し (Erlang で HBase Thrift を使用) ごとに、API は thrift 接続を返します。
アーランの例:
% 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()]),
これにより、以下の関連する問い合わせが発生します。
- 常に返された接続を使用する必要がありますか、それとも最初の接続のみを使用する必要がありますか?
- これらの接続は同じですか?
- このパスアロング接続アプローチは接続リークを引き起こしますか?
- これらの接続を閉じる方法はありますか、またはそれらを使用するすべてのタイプの API 呼び出しに対して独自のライフサイクルがありますか?