diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-09-18 14:24:10 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-09-18 14:24:10 +0100 |
| commit | 375d3935b370ddc779f882510ae657394c609762 (patch) | |
| tree | f1dee43166431a0ec11a2bfc30658d10f10e6905 /src | |
| parent | 9574e9796cf47ea7f3518ebe4835847eec37857a (diff) | |
| parent | 054c1fbd0795a0d2edd2d7f61105def06a5801c2 (diff) | |
| download | rabbitmq-server-git-375d3935b370ddc779f882510ae657394c609762.tar.gz | |
Merge in default
Diffstat (limited to 'src')
| -rw-r--r-- | src/gm.erl | 8 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_coordinator.erl | 9 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_slave.erl | 10 |
3 files changed, 13 insertions, 14 deletions
diff --git a/src/gm.erl b/src/gm.erl index 3113f44906..6c09e66417 100644 --- a/src/gm.erl +++ b/src/gm.erl @@ -62,7 +62,7 @@ %% %% leave/1 %% Provide the Pid. Removes the Pid from the group. The callback -%% terminate/2 function will be called. +%% handle_terminate/2 function will be called. %% %% broadcast/2 %% Provide the Pid and a Message. The message will be sent to all @@ -493,13 +493,13 @@ %% Called on gm member termination as per rules in gen_server, with %% the Args provided in start_link plus the termination Reason. --callback terminate(Args :: term(), Reason :: term()) -> +-callback handle_terminate(Args :: term(), Reason :: term()) -> ok | term(). -else. behaviour_info(callbacks) -> - [{joined, 2}, {members_changed, 3}, {handle_msg, 3}, {terminate, 2}]; + [{joined, 2}, {members_changed, 3}, {handle_msg, 3}, {handle_terminate, 2}]; behaviour_info(_Other) -> undefined. @@ -737,7 +737,7 @@ handle_info({'DOWN', MRef, process, _Pid, Reason}, terminate(Reason, State = #state { module = Module, callback_args = Args }) -> flush_broadcast_buffer(State), - Module:terminate(Args, Reason). + Module:handle_terminate(Args, Reason). code_change(_OldVsn, State, _Extra) -> diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl index 23718da18b..3d4605280f 100644 --- a/src/rabbit_mirror_queue_coordinator.erl +++ b/src/rabbit_mirror_queue_coordinator.erl @@ -21,7 +21,7 @@ -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). --export([joined/2, members_changed/3, handle_msg/3]). +-export([joined/2, members_changed/3, handle_msg/3, handle_terminate/2]). -behaviour(gen_server2). -behaviour(gm). @@ -384,10 +384,6 @@ handle_info(Msg, State) -> {stop, {unexpected_info, Msg}, State}. terminate(_Reason, #state{}) -> - %% gen_server case - ok; -terminate([_CPid], _Reason) -> - %% gm case ok. code_change(_OldVsn, State, _Extra) -> @@ -416,6 +412,9 @@ handle_msg([CPid], _From, {delete_and_terminate, _Reason} = Msg) -> handle_msg([_CPid], _From, _Msg) -> ok. +handle_terminate([_CPid], _Reason) -> + ok. + %% --------------------------------------------------------------------------- %% Others %% --------------------------------------------------------------------------- diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index 2da2e7a535..af1e21414c 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -30,7 +30,7 @@ code_change/3, handle_pre_hibernate/1, prioritise_call/4, prioritise_cast/3, prioritise_info/3, format_message_queue/2]). --export([joined/2, members_changed/3, handle_msg/3]). +-export([joined/2, members_changed/3, handle_msg/3, handle_terminate/2]). -behaviour(gen_server2). -behaviour(gm). @@ -338,10 +338,7 @@ terminate({shutdown, _} = R, State) -> terminate(Reason, State = #state{backing_queue = BQ, backing_queue_state = BQS}) -> terminate_common(State), - BQ:delete_and_terminate(Reason, BQS); -terminate([_SPid], _Reason) -> - %% gm case - ok. + BQ:delete_and_terminate(Reason, BQS). %% If the Reason is shutdown, or {shutdown, _}, it is not the queue %% being deleted: it's just the node going down. Even though we're a @@ -438,6 +435,9 @@ handle_msg([SPid], _From, {sync_start, Ref, Syncer, SPids}) -> handle_msg([SPid], _From, Msg) -> ok = gen_server2:cast(SPid, {gm, Msg}). +handle_terminate([_SPid], _Reason) -> + ok. + %% --------------------------------------------------------------------------- %% Others %% --------------------------------------------------------------------------- |
