You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 14:23:12 UTC

[02/33] rexi commit: updated refs/heads/master to bbf59a2

[2/3] Start a rexi_server per remote node

Switch sending rexi messages to the rexi_server handling requests for
the local node. This replaces the use of the singleton rexi_server
process with a rexi_server instance for each node.

The only slight gotchya in the switch is that we need to send kill
messages to both the per-node and singleton instances during the
transition because we can't tell which process may have generated the
job. The extra kill message will be removed in the next commit.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/commit/837f0457
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/tree/837f0457
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rexi/diff/837f0457

Branch: refs/heads/master
Commit: 837f0457a0e4e280fed6741af33e6a61c5fbf016
Parents: f5907c4
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Mar 22 15:07:53 2013 -0500
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Jul 23 17:56:26 2014 +0100

----------------------------------------------------------------------
 src/rexi.erl | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rexi/blob/837f0457/src/rexi.erl
----------------------------------------------------------------------
diff --git a/src/rexi.erl b/src/rexi.erl
index a4c786d..c970f80 100644
--- a/src/rexi.erl
+++ b/src/rexi.erl
@@ -19,8 +19,6 @@
 
 -include_lib("rexi/include/rexi.hrl").
 
--define(SERVER, rexi_server).
-
 start() ->
     application:start(rexi).
 
@@ -47,7 +45,7 @@ cast(Node, MFA) ->
 cast(Node, Caller, MFA) ->
     Ref = make_ref(),
     Msg = cast_msg({doit, {Caller, Ref}, get(nonce), MFA}),
-    rexi_utils:send({?SERVER, Node}, Msg),
+    rexi_utils:send(rexi_utils:server_pid(Node), Msg),
     Ref.
 
 %% @doc Executes apply(M, F, A) on Node.
@@ -61,7 +59,7 @@ cast(Node, Caller, MFA, Options) ->
         true ->
             Ref = make_ref(),
             Msg = cast_msg({doit, {Caller, Ref}, get(nonce), MFA}),
-            erlang:send({?SERVER, Node}, Msg),
+            erlang:send(rexi_utils:server_pid(Node), Msg),
             Ref;
         false ->
             cast(Node, Caller, MFA)
@@ -71,7 +69,10 @@ cast(Node, Caller, MFA, Options) ->
 %% No rexi_EXIT message will be sent.
 -spec kill(node(), reference()) -> ok.
 kill(Node, Ref) ->
-    rexi_utils:send({?SERVER, Node}, cast_msg({kill, Ref})),
+    % This first version is to tide us over during the upgrade. We'll
+    % remove it in the next commit that will be in a separate release.
+    rexi_utils:send({rexi_server, Node}, cast_msg({kill, Ref})),
+    rexi_utils:send(rexi_utils:server_pid(Node), cast_msg({kill, Ref})),
     ok.
 
 %% @equiv async_server_call(Server, self(), Request)