Author: dreiss
Date: Tue Jun 10 18:13:33 2008
New Revision: 666475

URL: http://svn.apache.org/viewvc?rev=666475&view=rev
Log:
add thrift_client:cast

Modified:
    incubator/thrift/trunk/lib/alterl/src/thrift_client.erl

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_client.erl
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_client.erl?rev=666475&r1=666474&r2=666475&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_client.erl (original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_client.erl Tue Jun 10 18:13:33 
2008
@@ -93,6 +93,10 @@
         {exception, Exception} -> throw(Exception)
     end.
 
+cast(Client, Function, Args)
+  when is_pid(Client), is_atom(Function), is_list(Args) ->
+    gen_server:cast(Client, {call, Function, Args}).
+
 %% Sends a function call but does not read the result. This is useful
 %% if you're trying to log non-async function calls to write-only
 %% transports like thrift_disk_log_transport.
@@ -100,7 +104,6 @@
   when is_pid(Client), is_atom(Function), is_list(Args) ->
     gen_server:call(Client, {send_call, Function, Args}).
 
-
 close(Client) when is_pid(Client) ->
     gen_server:cast(Client, close).
 
@@ -180,6 +183,20 @@
 %%                                      {stop, Reason, State}
 %% Description: Handling cast messages
 %%--------------------------------------------------------------------
+handle_cast({call, Function, Args}, State = #state{service = Service,
+                                                   protocol = Protocol,
+                                                   seqid = SeqId}) ->
+    _Result =
+        try
+            ok = send_function_call(State, Function, Args),
+            receive_function_result(State, Function)
+        catch
+            Class:Reason ->
+                error_logger:error_msg("error ignored in 
handle_cast({cast,...},...): ~p:~p~n", [Class, Reason])
+        end,
+
+    {noreply, State};
+
 handle_cast(close, State=#state{protocol = Protocol}) ->
 %%     error_logger:info_msg("thrift_client ~p received close", [self()]),
     {stop,normal,State};


Reply via email to