summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2010-03-08 12:14:06 +0000
committerMatthew Sackman <matthew@lshift.net>2010-03-08 12:14:06 +0000
commit9575deaa2207d3e5c703ebc4f2455543d2f41ee0 (patch)
treeb1162e0645de7e0b886111f27d43acca3d1c7095 /src
parent9fca249c3060f10c0bb51a548825c62eac8edae8 (diff)
parent66814729b3e136f2f90f9e9727373434a9eeb56b (diff)
downloadrabbitmq-server-git-9575deaa2207d3e5c703ebc4f2455543d2f41ee0.tar.gz
Merging default into bug 21673
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl18
-rw-r--r--src/rabbit_alarm.erl3
-rw-r--r--src/rabbit_amqqueue.erl2
-rw-r--r--src/rabbit_networking.erl8
-rw-r--r--src/rabbit_restartable_sup.erl54
-rw-r--r--src/rabbit_sup.erl5
6 files changed, 77 insertions, 13 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index b652958acf..d73f6859f4 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,
@@ -71,7 +72,8 @@
-rabbit_boot_step({file_handle_cache,
[{description, "file handle cache server"},
- {mfa, {rabbit_sup, start_child, [file_handle_cache]}},
+ {mfa, {rabbit_sup, start_child,
+ [file_handle_cache]}},
{enables, kernel_ready}]}).
-rabbit_boot_step({kernel_ready,
@@ -85,25 +87,29 @@
-rabbit_boot_step({rabbit_memory_monitor,
[{description, "memory moniter"},
- {mfa, {rabbit_sup, start_child, [rabbit_memory_monitor]}},
+ {mfa, {rabbit_sup, start_child,
+ [rabbit_memory_monitor]}},
{requires, rabbit_alarm},
{enables, core_initialized}]}).
-rabbit_boot_step({guid_generator,
[{description, "guid generator"},
- {mfa, {rabbit_sup, start_child, [rabbit_guid]}},
+ {mfa, {rabbit_restartable_sup, start_child,
+ [rabbit_guid]}},
{requires, kernel_ready},
{enables, core_initialized}]}).
-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},
{enables, core_initialized}]}).
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index 3b9eeec18a..d5d245aaa1 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 e333a43b9d..0b8a7d1049 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -135,7 +135,7 @@ start() ->
DurableQueues = find_durable_queues(),
ok = rabbit_queue_index:start_msg_store(DurableQueues),
{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 7978573d90..4d3197064c 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 ,
@@ -169,8 +169,8 @@ start_listener(Host, Port, Label, OnConnect) ->
stop_tcp_listener(Host, Port) ->
IPAddress = getaddr(Host),
Name = rabbit_misc:tcp_name(rabbit_tcp_listener_sup, IPAddress, Port),
- ok = supervisor:terminate_child(rabbit_sup, Name),
- ok = supervisor:delete_child(rabbit_sup, Name),
+ ok = supervisor:terminate_child(rabbit_restartable_sup, Name),
+ ok = supervisor:delete_child(rabbit_restartable_sup, Name),
ok.
tcp_listener_started(IPAddress, Port) ->
diff --git a/src/rabbit_restartable_sup.erl b/src/rabbit_restartable_sup.erl
new file mode 100644
index 0000000000..bc6f40da6b
--- /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 6cb697e0f1..63862d4e5a 100644
--- a/src/rabbit_sup.erl
+++ b/src/rabbit_sup.erl
@@ -53,4 +53,7 @@ start_child(Mod, Args) ->
ok.
init([]) ->
- {ok, {{one_for_one, 10, 10}, []}}.
+ {ok, {{one_for_all, 0, 1},
+ [{rabbit_restartable_sup,
+ {rabbit_restartable_sup, start_link, []},
+ transient, infinity, supervisor, [rabbit_restartable_sup]}]}}.