couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [02/27] rexi commit: updated refs/heads/windsor-merge to 096f0cf
Date Fri, 01 Aug 2014 09:06:31 GMT
[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/windsor-merge
Commit: 837f0457a0e4e280fed6741af33e6a61c5fbf016
Parents: f5907c4
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Fri Mar 22 15:07:53 2013 -0500
Committer: Robert Newson <rnewson@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)


Mime
View raw message