summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-08-09 16:36:44 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-08-09 16:36:44 +0100
commit645aea572e913b9d122cfb99370a5d5fdf69f5a5 (patch)
treed70a22b29d76c6ac04a812f984b85d20ebc0a39a
parent8f4756b806d9029c297c6cdc3ea111f5a97e9085 (diff)
downloadrabbitmq-server-645aea572e913b9d122cfb99370a5d5fdf69f5a5.tar.gz
Modify behaviour of intrinsic to be more like transient, except in the case of normal child exit
-rw-r--r--src/supervisor2.erl17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 3875997e..8d0f5f4b 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -31,13 +31,10 @@
%% the MaxT and MaxR parameters to permit the child to be
%% restarted. This may require waiting for longer than Delay.
%%
-%% 4) Added an 'intrinsic' restart type. This type means that the
-%% child should never be restarted (same as temporary) but whenever
-%% such a child exits, it will cause the entire supervisor to exit
-%% (i.e. the child's existence is intrinsic to the supervisor's
-%% existence). Because such children are never restarted, the
-%% supervisor's restart strategy, MaxT and MaxR have no bearing on
-%% such children.
+%% 4) Added an 'intrinsic' restart type. Like the transient type, this
+%% type means the child should only be restarted if the child exits
+%% abnormally. Unlike the transient type, if the child exits
+%% normally, the supervisor itself also exits normally.
%%
%% All modifications are (C) 2010 Rabbit Technologies Ltd.
%%
@@ -541,9 +538,6 @@ do_restart({RestartType, Delay}, Reason, Child, State) ->
end;
do_restart(intrinsic, normal, Child, State) ->
{shutdown, state_del_child(Child, State)};
-do_restart(intrinsic, Reason, Child, State) ->
- report_error(child_terminated, Reason, Child, State#state.name),
- {shutdown, state_del_child(Child, State)};
do_restart(permanent, Reason, Child, State) ->
report_error(child_terminated, Reason, Child, State#state.name),
restart(Child, State);
@@ -553,7 +547,8 @@ do_restart(_, normal, Child, State) ->
do_restart(_, shutdown, Child, State) ->
NState = state_del_child(Child, State),
{ok, NState};
-do_restart(transient, Reason, Child, State) ->
+do_restart(Type, Reason, Child, State) when Type =:= transient orelse
+ Type =:= intrinsic ->
report_error(child_terminated, Reason, Child, State#state.name),
restart(Child, State);
do_restart(temporary, Reason, Child, State) ->