summaryrefslogtreecommitdiff
path: root/src/rabbit_connection_sup.erl
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-08-03 13:11:27 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-08-03 13:11:27 +0100
commit2c470c48f6d20929d29a543a407e06da63a9028e (patch)
treee3ed1bdab9147e5609cfe18353e8ee35ba470310 /src/rabbit_connection_sup.erl
parentbb9b11a2eb4c76877b43296cd602cec43ca3ad99 (diff)
downloadrabbitmq-server-2c470c48f6d20929d29a543a407e06da63a9028e.tar.gz
Avoid the unnecessary callbacks in the various new _sups as much as possible by breaking the declarative child specs but trying hard to keep them declarative as much as possible.
Diffstat (limited to 'src/rabbit_connection_sup.erl')
-rw-r--r--src/rabbit_connection_sup.erl25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl
index 4ad9d3f0..8d09961f 100644
--- a/src/rabbit_connection_sup.erl
+++ b/src/rabbit_connection_sup.erl
@@ -33,28 +33,31 @@
-behaviour(supervisor2).
--export([start_link/0, reader/1, channel_sup_sup/1]).
+-export([start_link/0, reader/1]).
-export([init/1]).
-include("rabbit.hrl").
start_link() ->
- supervisor2:start_link(?MODULE, []).
+ {ok, SupPid} = supervisor2:start_link(?MODULE, []),
+ {ok, ChannelSupSupPid} =
+ supervisor2:start_child(
+ SupPid,
+ {channel_sup_sup, {rabbit_channel_sup_sup, start_link, []},
+ permanent, infinity, supervisor, [rabbit_channel_sup_sup]}),
+ {ok, _ReaderPid} =
+ supervisor2:start_child(
+ SupPid,
+ {reader, {rabbit_reader, start_link, [ChannelSupSupPid]},
+ permanent, ?MAX_WAIT, worker, [rabbit_reader]}),
+ {ok, SupPid}.
init([]) ->
{ok, {{one_for_all, 0, 1},
- [{channel_sup_sup, {rabbit_channel_sup_sup, start_link, []},
- permanent, infinity, supervisor, [rabbit_channel_sup_sup]},
- {reader, {rabbit_reader, start_link, []},
- permanent, ?MAX_WAIT, worker, [rabbit_reader]},
- {collector, {rabbit_queue_collector, start_link, []},
+ [{collector, {rabbit_queue_collector, start_link, []},
permanent, ?MAX_WAIT, worker, [rabbit_queue_collector]}
]}}.
reader(Pid) ->
hd(supervisor2:find_child(Pid, reader)).
-
-channel_sup_sup(Pid) ->
- hd(supervisor2:find_child(Pid, channel_sup_sup)).
-