diff options
| author | Tim Watson <tim@rabbitmq.com> | 2012-11-08 14:52:05 +0000 |
|---|---|---|
| committer | Tim Watson <tim@rabbitmq.com> | 2012-11-08 14:52:05 +0000 |
| commit | 3b3ca785f1e2e8ad1d3cb67f7add6e971f27b577 (patch) | |
| tree | bed9e5d125745494ec535402a71021a6fddff451 /src/rabbit.erl | |
| parent | aaba39a9aeb52f0b63a5e76581de8e8516ea117d (diff) | |
| download | rabbitmq-server-git-3b3ca785f1e2e8ad1d3cb67f7add6e971f27b577.tar.gz | |
introduce a noop process at the head of rabbit_sup's children,
which we now monitor instead of the rabbit application's pid
Diffstat (limited to 'src/rabbit.erl')
| -rw-r--r-- | src/rabbit.erl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index c52c296ad3..8c13224fc4 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -21,7 +21,7 @@ -export([start/0, boot/0, stop/0, stop_and_halt/0, await_startup/0, status/0, is_running/0, is_running/1, environment/0, rotate_logs/1, force_event_refresh/0, - start_fhc/0]). + start_fhc/0, start_app_marker/1, hibernate/0]). -export([start/2, stop/1]). @@ -174,10 +174,15 @@ [{mfa, {rabbit_networking, boot, []}}, {requires, log_relay}]}). +-rabbit_boot_step({app_running, + [{description, "cluster membership"}, + {mfa, {rabbit, start_app_marker, [boot]}}, + {requires, networking}]}). + -rabbit_boot_step({notify_cluster, [{description, "notify cluster nodes"}, {mfa, {rabbit_node_monitor, notify_node_up, []}}, - {requires, networking}]}). + {requires, app_running}]}). %%--------------------------------------------------------------------------- @@ -770,3 +775,16 @@ start_fhc() -> rabbit_sup:start_restartable_child( file_handle_cache, [fun rabbit_alarm:set_alarm/1, fun rabbit_alarm:clear_alarm/1]). + +start_app_marker(boot) -> + supervisor:start_child(rabbit_sup, + {rabbit_app, {?MODULE, start_app_marker, [spawn]}, + transient, ?MAX_WAIT, worker, [?MODULE]}); +start_app_marker(spawn) -> + Pid = spawn_link(fun() -> erlang:hibernate(?MODULE, hibernate, []) end), + register(rabbit_running, Pid), + {ok, Pid}. + +hibernate() -> + erlang:hibernate(?MODULE, hibernate, []). + |
