summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2010-03-05 17:08:22 +0000
committerMatthew Sackman <matthew@lshift.net>2010-03-05 17:08:22 +0000
commit8f5897b07f03ea98c380c8849c3a0b1c39fe0ff9 (patch)
tree4e0401f82b1a0bb231190db5ae678564cd1e3b58
parent97ea22dab345e1c237518f4e5a111462a7ee022c (diff)
downloadrabbitmq-server-8f5897b07f03ea98c380c8849c3a0b1c39fe0ff9.tar.gz
reworked supervisor hierarchy
-rw-r--r--src/rabbit.erl12
-rw-r--r--src/rabbit_alarm.erl3
-rw-r--r--src/rabbit_amqqueue.erl2
-rw-r--r--src/rabbit_networking.erl4
-rw-r--r--src/rabbit_restartable_sup.erl54
-rw-r--r--src/rabbit_sup.erl10
6 files changed, 73 insertions, 12 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 6084be1b..94d852f9 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -61,7 +61,8 @@
-rabbit_boot_step({rabbit_log,
[{description, "logging server"},
- {mfa, {rabbit_sup, start_child, [rabbit_log]}},
+ {mfa, {rabbit_restartable_sup, start_child,
+ [rabbit_log]}},
{enables, kernel_ready}]}).
-rabbit_boot_step({rabbit_hooks,
@@ -86,13 +87,15 @@
-rabbit_boot_step({rabbit_router,
[{description, "cluster router"},
- {mfa, {rabbit_sup, start_child, [rabbit_router]}},
+ {mfa, {rabbit_restartable_sup, start_child,
+ [rabbit_router]}},
{requires, kernel_ready},
{enables, core_initialized}]}).
-rabbit_boot_step({rabbit_node_monitor,
[{description, "node monitor"},
- {mfa, {rabbit_sup, start_child, [rabbit_node_monitor]}},
+ {mfa, {rabbit_restartable_sup, start_child,
+ [rabbit_node_monitor]}},
{requires, kernel_ready},
{requires, rabbit_amqqueue_sup},
{enables, core_initialized}]}).
@@ -121,7 +124,8 @@
-rabbit_boot_step({guid_generator,
[{description, "guid generator"},
- {mfa, {rabbit_sup, start_child, [rabbit_guid]}},
+ {mfa, {rabbit_restartable_sup, start_child,
+ [rabbit_guid]}},
{requires, persister},
{enables, routing_ready}]}).
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index 3b9eeec1..d5d245aa 100644
--- a/src/rabbit_alarm.erl
+++ b/src/rabbit_alarm.erl
@@ -60,7 +60,8 @@ start() ->
true ->
ok;
false ->
- rabbit_sup:start_child(vm_memory_monitor, [MemoryWatermark])
+ rabbit_restartable_sup:start_child(vm_memory_monitor,
+ [MemoryWatermark])
end,
ok.
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index ceec00fd..f1e5e14b 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -119,7 +119,7 @@
start() ->
{ok,_} = supervisor:start_child(
- rabbit_sup,
+ rabbit_restartable_sup,
{rabbit_amqqueue_sup,
{rabbit_amqqueue_sup, start_link, []},
transient, infinity, supervisor, [rabbit_amqqueue_sup]}),
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index 7978573d..1871acc0 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -109,7 +109,7 @@ boot_ssl() ->
start() ->
{ok,_} = supervisor:start_child(
- rabbit_sup,
+ rabbit_restartable_sup,
{rabbit_tcp_client_sup,
{tcp_client_sup, start_link,
[{local, rabbit_tcp_client_sup},
@@ -156,7 +156,7 @@ start_listener(Host, Port, Label, OnConnect) ->
{IPAddress, Name} =
check_tcp_listener_address(rabbit_tcp_listener_sup, Host, Port),
{ok,_} = supervisor:start_child(
- rabbit_sup,
+ rabbit_restartable_sup,
{Name,
{tcp_listener_sup, start_link,
[IPAddress, Port, ?RABBIT_TCP_OPTS ,
diff --git a/src/rabbit_restartable_sup.erl b/src/rabbit_restartable_sup.erl
new file mode 100644
index 00000000..bc6f40da
--- /dev/null
+++ b/src/rabbit_restartable_sup.erl
@@ -0,0 +1,54 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (the "License"); you may not use this file except in
+%% compliance with the License. You may obtain a copy of the License at
+%% http://www.mozilla.org/MPL/
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+%% License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% The Original Code is RabbitMQ.
+%%
+%% The Initial Developers of the Original Code are LShift Ltd,
+%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+%%
+%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+%% Technologies LLC, and Rabbit Technologies Ltd.
+%%
+%% Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
+%% Ltd. Portions created by Cohesive Financial Technologies LLC are
+%% Copyright (C) 2007-2010 Cohesive Financial Technologies
+%% LLC. Portions created by Rabbit Technologies Ltd are Copyright
+%% (C) 2007-2010 Rabbit Technologies Ltd.
+%%
+%% All Rights Reserved.
+%%
+%% Contributor(s): ______________________________________.
+%%
+
+-module(rabbit_restartable_sup).
+
+-behaviour(supervisor).
+
+-export([start_link/0, start_child/1, start_child/2]).
+
+-export([init/1]).
+
+-define(SERVER, ?MODULE).
+
+start_link() ->
+ supervisor:start_link({local, ?SERVER}, ?MODULE, []).
+
+start_child(Mod) ->
+ start_child(Mod, []).
+
+start_child(Mod, Args) ->
+ {ok, _} = supervisor:start_child(?SERVER, {Mod, {Mod, start_link, Args},
+ transient, 100, worker, [Mod]}),
+ ok.
+
+init([]) ->
+ {ok, {{one_for_one, 10, 10}, []}}.
diff --git a/src/rabbit_sup.erl b/src/rabbit_sup.erl
index a1b89481..99548381 100644
--- a/src/rabbit_sup.erl
+++ b/src/rabbit_sup.erl
@@ -46,10 +46,12 @@ start_child(Mod) ->
start_child(Mod, []).
start_child(Mod, Args) ->
- {ok, _} = supervisor:start_child(?SERVER,
- {Mod, {Mod, start_link, Args},
- transient, 100, worker, [Mod]}),
+ {ok, _} = supervisor:start_child(?SERVER, {Mod, {Mod, start_link, Args},
+ transient, 100, worker, [Mod]}),
ok.
init([]) ->
- {ok, {{one_for_one, 10, 10}, []}}.
+ {ok, {{one_for_all, 0, 1},
+ [{rabbit_restartable_sup,
+ {rabbit_restartable_sup, start_link, []},
+ transient, 100, supervisor, [rabbit_restartable_sup]}]}}.