THRIFT-599. erl: Don't use unnecessary processes in the Erlang transports and clients
The only user-visible changes are to the client. Every thrift call now returns {NewClient, Result} instead of just Result.
Patch: David Reiss (assist to Anthony Molinaro)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@987018 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/erl/src/test_disklog.erl b/test/erl/src/test_disklog.erl
index 7b0be72..fc0dcf8 100644
--- a/test/erl/src/test_disklog.erl
+++ b/test/erl/src/test_disklog.erl
@@ -29,20 +29,21 @@
{size, {1024*1024, 10}}]),
{ok, ProtocolFactory} = thrift_binary_protocol:new_protocol_factory(
TransportFactory, []),
- {ok, Client} = thrift_client:start_link(ProtocolFactory, thriftTest_thrift),
+ {ok, Proto} = ProtocolFactory(),
+ {ok, Client0} = thrift_client:new(Proto, thriftTest_thrift),
io:format("Client started~n"),
% We have to make oneway calls into this client only since otherwise it will try
% to read from the disklog and go boom.
- {ok, ok} = thrift_client:call(Client, testOneway, [16#deadbeef]),
+ {Client1, {ok, ok}} = thrift_client:call(Client0, testOneway, [16#deadbeef]),
io:format("Call written~n"),
% Use the send_call method to write a non-oneway call into the log
- ok = thrift_client:send_call(Client, testString, [<<"hello world">>]),
+ {Client2, ok} = thrift_client:send_call(Client1, testString, [<<"hello world">>]),
io:format("Non-oneway call sent~n"),
- ok = thrift_client:close(Client),
+ {_Client3, ok} = thrift_client:close(Client2),
io:format("Client closed~n"),
ok.
@@ -61,21 +62,22 @@
thrift_buffered_transport:new_transport_factory(B64Factory),
{ok, ProtocolFactory} = thrift_binary_protocol:new_protocol_factory(
BufFactory, []),
- {ok, Client} = thrift_client:start_link(ProtocolFactory, thriftTest_thrift),
+ {ok, Proto} = ProtocolFactory(),
+ {ok, Client0} = thrift_client:new(Proto, thriftTest_thrift),
io:format("Client started~n"),
% We have to make oneway calls into this client only since otherwise it will try
% to read from the disklog and go boom.
- {ok, ok} = thrift_client:call(Client, testOneway, [16#deadbeef]),
+ {Client1, {ok, ok}} = thrift_client:call(Client0, testOneway, [16#deadbeef]),
io:format("Call written~n"),
% Use the send_call method to write a non-oneway call into the log
- ok = thrift_client:send_call(Client, testString, [<<"hello world">>]),
+ {Client2, ok} = thrift_client:send_call(Client1, testString, [<<"hello world">>]),
io:format("Non-oneway call sent~n"),
- ok = thrift_client:close(Client),
+ {_Client3, ok} = thrift_client:close(Client2),
io:format("Client closed~n"),
ok.
-
+