summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-07-27 17:01:03 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-07-27 17:01:03 +0100
commit3537756d0397431e4ffa043a48ba68db8d5f4f12 (patch)
tree53d907740095618123086575dd964919086c7e8e
parent1f163036f49001bb05eee3825d7a59b7d30b48a8 (diff)
downloadrabbitmq-server-3537756d0397431e4ffa043a48ba68db8d5f4f12.tar.gz
Remove dead code and get supervisor2 to hide some error messages when MaxR is 0
-rw-r--r--src/rabbit_connection_sup.erl5
-rw-r--r--src/supervisor2.erl18
2 files changed, 14 insertions, 9 deletions
diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl
index 53d086f0..3dd81ef6 100644
--- a/src/rabbit_connection_sup.erl
+++ b/src/rabbit_connection_sup.erl
@@ -33,7 +33,7 @@
-behaviour(supervisor2).
--export([start_link/0, stop/1, reader/1, channel_sup_sup/1]).
+-export([start_link/0, reader/1, channel_sup_sup/1]).
-export([init/1]).
@@ -42,9 +42,6 @@
start_link() ->
supervisor2:start_link(?MODULE, []).
-stop(Pid) ->
- supervisor2:stop(Pid).
-
init([]) ->
{ok, {{one_for_all, 0, 1},
[{reader, {rabbit_reader, start_link, []},
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 046d1f02..be24e09b 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -8,6 +8,10 @@
%% simple_one_for_one, except that children *are* explicitly
%% terminated as per the shutdown component of the child_spec.
%%
+%% 3) When the MaxR (intensity) == 0, errors that would otherwise be
+%% reported concerning child death, or the reaching of max restart
+%% intensity are elided.
+%%
%% All modifications are (C) 2010 LShift Ltd.
%%
%% %CopyrightBegin%
@@ -490,7 +494,7 @@ restart_child(Pid, Reason, State) ->
end.
do_restart(permanent, Reason, Child, State) ->
- report_error(child_terminated, Reason, Child, State#state.name),
+ report_error(child_terminated, Reason, Child, State),
restart(Child, State);
do_restart(_, normal, Child, State) ->
NState = state_del_child(Child, State),
@@ -499,10 +503,10 @@ do_restart(_, shutdown, Child, State) ->
NState = state_del_child(Child, State),
{ok, NState};
do_restart(transient, Reason, Child, State) ->
- report_error(child_terminated, Reason, Child, State#state.name),
+ report_error(child_terminated, Reason, Child, State),
restart(Child, State);
do_restart(temporary, Reason, Child, State) ->
- report_error(child_terminated, Reason, Child, State#state.name),
+ report_error(child_terminated, Reason, Child, State),
NState = state_del_child(Child, State),
{ok, NState}.
@@ -511,8 +515,8 @@ restart(Child, State) ->
{ok, NState} ->
restart(NState#state.strategy, Child, NState);
{terminate, NState} ->
- report_error(shutdown, reached_max_restart_intensity,
- Child, State#state.name),
+ report_error(shutdown, reached_max_restart_intensity,
+ Child, State),
{shutdown, remove_child(Child, NState)}
end.
@@ -913,6 +917,10 @@ difference({_, TimeS, _}, {_, CurS, _}) ->
%%% Error and progress reporting.
%%% ------------------------------------------------------
+report_error(_Error, _Reason, _Child, #state{intensity = 0}) ->
+ ok;
+report_error(Error, Reason, Child, #state{name=Name}) ->
+ report_error(Error, Reason, Child, Name);
report_error(Error, Reason, Child, SupName) ->
ErrorMsg = [{supervisor, SupName},
{errorContext, Error},